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/Common/UI/UIBitmapFont.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Minecraft.Client/Common/UI/UIBitmapFont.cpp') diff --git a/Minecraft.Client/Common/UI/UIBitmapFont.cpp b/Minecraft.Client/Common/UI/UIBitmapFont.cpp index 31eef281..2b1518c4 100644 --- a/Minecraft.Client/Common/UI/UIBitmapFont.cpp +++ b/Minecraft.Client/Common/UI/UIBitmapFont.cpp @@ -53,42 +53,42 @@ void UIAbstractBitmapFont::registerFont() IggyFontMetrics * RADLINK UIAbstractBitmapFont::GetFontMetrics_Callback(void *user_context,IggyFontMetrics *metrics) { - return ((UIAbstractBitmapFont *) user_context)->GetFontMetrics(metrics); + return static_cast(user_context)->GetFontMetrics(metrics); } S32 RADLINK UIAbstractBitmapFont::GetCodepointGlyph_Callback(void *user_context,U32 codepoint) { - return ((UIAbstractBitmapFont *) user_context)->GetCodepointGlyph(codepoint); + return static_cast(user_context)->GetCodepointGlyph(codepoint); } IggyGlyphMetrics * RADLINK UIAbstractBitmapFont::GetGlyphMetrics_Callback(void *user_context,S32 glyph,IggyGlyphMetrics *metrics) { - return ((UIAbstractBitmapFont *) user_context)->GetGlyphMetrics(glyph,metrics); + return static_cast(user_context)->GetGlyphMetrics(glyph,metrics); } rrbool RADLINK UIAbstractBitmapFont::IsGlyphEmpty_Callback(void *user_context,S32 glyph) { - return ((UIAbstractBitmapFont *) user_context)->IsGlyphEmpty(glyph); + return static_cast(user_context)->IsGlyphEmpty(glyph); } F32 RADLINK UIAbstractBitmapFont::GetKerningForGlyphPair_Callback(void *user_context,S32 first_glyph,S32 second_glyph) { - return ((UIAbstractBitmapFont *) user_context)->GetKerningForGlyphPair(first_glyph,second_glyph); + return static_cast(user_context)->GetKerningForGlyphPair(first_glyph,second_glyph); } rrbool RADLINK UIAbstractBitmapFont::CanProvideBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale) { - return ((UIAbstractBitmapFont *) user_context)->CanProvideBitmap(glyph,pixel_scale); + return static_cast(user_context)->CanProvideBitmap(glyph,pixel_scale); } rrbool RADLINK UIAbstractBitmapFont::GetGlyphBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap) { - return ((UIAbstractBitmapFont *) user_context)->GetGlyphBitmap(glyph,pixel_scale,bitmap); + return static_cast(user_context)->GetGlyphBitmap(glyph,pixel_scale,bitmap); } void RADLINK UIAbstractBitmapFont::FreeGlyphBitmap_Callback(void *user_context,S32 glyph,F32 pixel_scale,IggyBitmapCharacter *bitmap) { - return ((UIAbstractBitmapFont *) user_context)->FreeGlyphBitmap(glyph,pixel_scale,bitmap); + return static_cast(user_context)->FreeGlyphBitmap(glyph,pixel_scale,bitmap); } UIBitmapFont::UIBitmapFont( SFontData &sfontdata ) @@ -325,7 +325,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte // 4J-PB - this was chopping off the top of the characters, so accented ones were losing a couple of pixels at the top // DaveK has reduced the height of the accented capitalised characters, and we've dropped this from 0.65 to 0.64 - bitmap->top_left_y = -((S32) m_cFontData->getFontData()->m_uiGlyphHeight) * m_cFontData->getFontData()->m_fAscent; + bitmap->top_left_y = -static_cast(m_cFontData->getFontData()->m_uiGlyphHeight) * m_cFontData->getFontData()->m_fAscent; bitmap->oversample = 0; @@ -385,7 +385,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte bitmap->stride_in_bytes = m_cFontData->getFontData()->m_uiGlyphMapX; // 4J-JEV: Additional information needed to release memory afterwards. - bitmap->user_context_for_free = NULL; + bitmap->user_context_for_free = nullptr; return true; } -- cgit v1.2.3