1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-15 20:12:35 +01:00

Fix #11043: Null banner object had method called on itself (#11049)

This commit is contained in:
Michał Janiszewski
2020-03-25 22:57:15 +01:00
committed by GitHub
parent 268e81c21b
commit 95e2590207

View File

@@ -427,24 +427,27 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei
// 6B809A: // 6B809A:
uint16_t scrollMode = entry->large_scenery.scrolling_mode + ((direction + 1) & 0x3); uint16_t scrollMode = entry->large_scenery.scrolling_mode + ((direction + 1) & 0x3);
auto banner = tileElement->AsLargeScenery()->GetBanner(); auto banner = tileElement->AsLargeScenery()->GetBanner();
banner->FormatTextTo(gCommonFormatArgs); if (banner != nullptr)
utf8 signString[256];
if (gConfigGeneral.upper_case_banners)
{ {
format_string_to_upper(signString, sizeof(signString), STR_SCROLLING_SIGN_TEXT, gCommonFormatArgs); banner->FormatTextTo(gCommonFormatArgs);
} utf8 signString[256];
else if (gConfigGeneral.upper_case_banners)
{ {
format_string(signString, sizeof(signString), STR_SCROLLING_SIGN_TEXT, gCommonFormatArgs); format_string_to_upper(signString, sizeof(signString), STR_SCROLLING_SIGN_TEXT, gCommonFormatArgs);
} }
else
{
format_string(signString, sizeof(signString), STR_SCROLLING_SIGN_TEXT, gCommonFormatArgs);
}
gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY; gCurrentFontSpriteBase = FONT_SPRITE_BASE_TINY;
uint16_t stringWidth = gfx_get_string_width(signString); uint16_t stringWidth = gfx_get_string_width(signString);
uint16_t scroll = stringWidth > 0 ? (gCurrentTicks / 2) % stringWidth : 0; uint16_t scroll = stringWidth > 0 ? (gCurrentTicks / 2) % stringWidth : 0;
sub_98199C( sub_98199C(
session, scrolling_text_setup(session, STR_SCROLLING_SIGN_TEXT, scroll, scrollMode, textColour), 0, 0, 1, 1, 21, session, scrolling_text_setup(session, STR_SCROLLING_SIGN_TEXT, scroll, scrollMode, textColour), 0, 0, 1, 1, 21,
height + 25, boxoffset.x, boxoffset.y, boxoffset.z); height + 25, boxoffset.x, boxoffset.y, boxoffset.z);
}
large_scenery_paint_supports(session, direction, height, tileElement, dword_F4387C, tile); large_scenery_paint_supports(session, direction, height, tileElement, dword_F4387C, tile);
} }