1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-29 17:54:50 +01:00

Fix #13477: Plug-in widget tooltips do not work (#13486)

This commit is contained in:
Ted John
2020-11-30 00:11:07 +00:00
committed by GitHub
parent a7481b40b4
commit 8021af2c6b
2 changed files with 21 additions and 15 deletions

View File

@@ -10,6 +10,7 @@
- Fix: [#13427] Newly created Go-Karts show "Race won by <blank>".
- Fix: [#13454] Plug-ins do not load on Windows if the user directory contains non-ASCII characters.
- Fix: [#13469] Exception thrown from plugin in context.subscribe.
- Fix: [#13477] Plug-in widget tooltips do not work.
- Improved: [#12917] Changed peep movement so that they stay more spread out over the full width of single tile paths.
- Removed: [#13423] Built-in explode guests cheat (replaced by plug-in).

View File

@@ -103,32 +103,37 @@ void window_tooltip_show(const OpenRCT2String& message, ScreenCoordsXY screenCoo
*/
void window_tooltip_open(rct_window* widgetWindow, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCords)
{
rct_widget* widget;
if (widgetWindow == nullptr || widgetIndex == -1)
return;
widget = &widgetWindow->widgets[widgetIndex];
auto widget = &widgetWindow->widgets[widgetIndex];
window_event_invalidate_call(widgetWindow);
rct_string_id stringId = widget->tooltip;
if (stringId == STR_NONE)
return;
gTooltipWidget.window_classification = widgetWindow->classification;
gTooltipWidget.window_number = widgetWindow->number;
gTooltipWidget.widget_index = widgetIndex;
auto result = window_event_tooltip_call(widgetWindow, widgetIndex, stringId);
if (result.str == STR_NONE)
return;
OpenRCT2String result;
if (widget->flags & WIDGET_FLAGS::TOOLTIP_IS_STRING)
{
result.str = STR_STRING_TOOLTIP;
result.args = Formatter();
result.args.Add<const char*>(widget->sztooltip);
gTooltipWidget.window_classification = widgetWindow->classification;
gTooltipWidget.window_number = widgetWindow->number;
gTooltipWidget.widget_index = widgetIndex;
}
else
{
auto stringId = widget->tooltip;
if (stringId == STR_NONE)
return;
gTooltipWidget.window_classification = widgetWindow->classification;
gTooltipWidget.window_number = widgetWindow->number;
gTooltipWidget.widget_index = widgetIndex;
result = window_event_tooltip_call(widgetWindow, widgetIndex, stringId);
if (result.str == STR_NONE)
return;
}
window_tooltip_show(result, screenCords);
}