From 28614b922fb77149a54da1a87bebfbc98736f296 Mon Sep 17 00:00:00 2001 From: ModMaker101 <119018978+ModMaker101@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:08:36 -0400 Subject: Modernize project codebase (#906) * Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides * Add safety checks and fix a issue with vector going OOR --- Minecraft.Client/Xbox/Font/XUI_FontData.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Minecraft.Client/Xbox/Font/XUI_FontData.cpp') diff --git a/Minecraft.Client/Xbox/Font/XUI_FontData.cpp b/Minecraft.Client/Xbox/Font/XUI_FontData.cpp index 7a70cdfb..88d77d09 100644 --- a/Minecraft.Client/Xbox/Font/XUI_FontData.cpp +++ b/Minecraft.Client/Xbox/Font/XUI_FontData.cpp @@ -68,7 +68,7 @@ float XUI_FontData::SChar::getMinX() float XUI_FontData::SChar::getMaxX() { - return (float) m_parent->m_fontData->getFontData()->m_uiGlyphWidth; + return static_cast(m_parent->m_fontData->getFontData()->m_uiGlyphWidth); } float XUI_FontData::SChar::getMinY() @@ -83,7 +83,7 @@ float XUI_FontData::SChar::getMaxY() float XUI_FontData::SChar::getAdvance() { - return (float) m_parent->m_fontData->getWidth(m_glyphId); + return static_cast(m_parent->m_fontData->getWidth(m_glyphId)); } int XUI_FontData::SChar::getGlyphId() @@ -157,11 +157,11 @@ XUI_FontData::SChar XUI_FontData::getChar(const wchar_t strChar) //-------------------------------------------------------------------------------------- XUI_FontData::XUI_FontData() { - m_pFontTexture = NULL; + m_pFontTexture = nullptr; m_iFontTexture = -1; m_dwNumGlyphs = 0L; - m_Glyphs = NULL; + m_Glyphs = nullptr; m_cMaxGlyph = 0; @@ -201,12 +201,12 @@ HRESULT XUI_FontData::Create( SFontData &sfontdata ) m_fontData = new CFontData( sfontdata, rawPixels.data ); - if (rawPixels.data != NULL) delete [] rawPixels.data; + if (rawPixels.data != nullptr) delete [] rawPixels.data; #if 0 { // 4J-JEV: Load in FontData (ABC) file, and initialize member variables from it. - const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL); + const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr); //wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/font/Mojangles_10.abc"); wsprintfW(szResourceLocator,L"section://%X,%s#%s%s%s",c_ModuleHandle,L"media", L"media/font/",strFontFileName.c_str(),L".abc"); @@ -349,7 +349,7 @@ HRESULT XUI_FontData::Create( int iFontTexture, const VOID* pFontData ) //-------------------------------------------------------------------------------------- VOID XUI_FontData::Destroy() { - if(m_pFontTexture!=NULL) + if(m_pFontTexture!=nullptr) { m_pFontTexture->Release(); delete m_pFontTexture; @@ -357,7 +357,7 @@ VOID XUI_FontData::Destroy() m_fontData->release(); - m_pFontTexture = NULL; + m_pFontTexture = nullptr; m_dwNumGlyphs = 0L; m_cMaxGlyph = 0; -- cgit v1.2.3