1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-28 17:24:47 +01:00

Introduce MakeTab wrapper function

The MakeTab function is only applied in two places, for the moment:
the Cheats and Options windows.
This commit is contained in:
Aaron van Geffen
2020-08-13 16:41:13 +02:00
parent 72be84caf8
commit 4a55acd71e
4 changed files with 38 additions and 18 deletions

View File

@@ -215,9 +215,21 @@ static void widget_tab_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgetind
// Get the widget
rct_widget* widget = &w->widgets[widgetIndex];
if (static_cast<int32_t>(widget->image) == -1)
if (widget->type != WWT_TAB && static_cast<int32_t>(widget->image) == -1)
return;
if (widget->type == WWT_TAB)
{
if (widget_is_disabled(w, widgetIndex))
return;
if (widget->image != (IMAGE_TYPE_REMAP | SPR_TAB_LARGE))
{
// Set standard tab sprite to use.
widget->image = IMAGE_TYPE_REMAP | SPR_TAB;
}
}
// Draw widgets that aren't explicitly disabled.
if (!widget_is_disabled(w, widgetIndex))
{
@@ -225,10 +237,6 @@ static void widget_tab_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widgetind
return;
}
// Do not draw hidden tabs, unless given a sprite.
if (widget->type == WWT_TAB && widget->image != (IMAGE_TYPE_REMAP | SPR_G2_TAB_DISABLED))
return;
if (widget->type != WWT_TRNBTN)
{
widget_draw_image(dpi, w, widgetIndex);