1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-31 02:35:46 +01:00

Remove gMapTooltip format args global (#12971)

Fix mistake
This commit is contained in:
Duncan
2020-09-29 01:45:28 +01:00
committed by GitHub
parent a0341a7aeb
commit 3c8adb1fc1
12 changed files with 85 additions and 29 deletions

View File

@@ -39,6 +39,18 @@ static int32_t _cursorHoldDuration;
static void window_map_tooltip_open();
static Formatter _mapTooltipArgs;
void SetMapTooltip(Formatter& ft)
{
_mapTooltipArgs = ft;
}
const Formatter& GetMapTooltip()
{
return _mapTooltipArgs;
}
/**
*
* rct2: 0x006EE77A
@@ -65,7 +77,7 @@ void window_map_tooltip_update_visibility()
// Show or hide tooltip
rct_string_id stringId;
std::memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id));
std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(rct_string_id));
if (_cursorHoldDuration < 25 || stringId == STR_NONE
|| input_test_place_object_modifier(
@@ -126,12 +138,13 @@ static void window_map_tooltip_update(rct_window* w)
static void window_map_tooltip_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
rct_string_id stringId;
std::memcpy(&stringId, gMapTooltipFormatArgs, sizeof(rct_string_id));
std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(rct_string_id));
if (stringId == STR_NONE)
{
return;
}
ScreenCoordsXY stringCoords(w->windowPos.x + (w->width / 2), w->windowPos.y + (w->height / 2));
gfx_draw_string_centred_wrapped(dpi, gMapTooltipFormatArgs, stringCoords, w->width, STR_MAP_TOOLTIP_STRINGID, COLOUR_BLACK);
gfx_draw_string_centred_wrapped(
dpi, _mapTooltipArgs.Data(), stringCoords, w->width, STR_MAP_TOOLTIP_STRINGID, COLOUR_BLACK);
}