mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-27 16:54:52 +01:00
Refactor widgets state (#23621)
* Refactor windows to not share widget state * First half of refactoring all the windows * Refactor the remaining windows, compiles but has issues * Fix drawing only every second widget * Remove the need of an terminating widget * Address WidgetIndex signedness issues; use kWidgetIndexNull more * Address constexpr issue with Widget content union * Fix tabs in scenery window * Fix tabs in object selection window * Adjust custom widget index for CustomTool events * Use STR_NONE for default tooltip initialisation * Adjustment for mingw compiler * Fix bottom toolbar using the widget declaration not instance * Remove pointless code in Guest window, handled by SetPage * Prevent out of bounds crash * Move scroll widgets initialization to SetPage in Cheats window * Remove special logic in Options window * Remove special logic in Park window * Remove special logic for Player window * Remove special logic for Research window * Remove special logic for Ride window * Remove special logic for Staff window * Remove special logic for Finances window * Remove special logic for MapGen window * Remove special logic for editor objective options window * Remove special logic for editor scenario options window * Fix widgets not being set since page is initialized to 0 * Remove more redundant code * Fix remaining access to widget declarations * Remove unused variable * Fix editor object selection tabs on successive windows --------- Co-authored-by: Aaron van Geffen <aaron@aaronweb.net>
This commit is contained in:
@@ -272,9 +272,10 @@ namespace OpenRCT2::Scripting
|
||||
auto toolbarWindow = windowMgr->FindByClass(WindowClass::TopToolbar);
|
||||
if (toolbarWindow != nullptr)
|
||||
{
|
||||
// Use a widget that does not exist on top toolbar but also make sure it isn't -1 as that
|
||||
// prevents abort from being called.
|
||||
WidgetIndex widgetIndex = -2;
|
||||
// Use a widget that does not exist on top toolbar but also make sure it isn't
|
||||
// kWidgetIndexNull, as that prevents abort from being called.
|
||||
// TODO: refactor this to not leech on the top toolbar.
|
||||
WidgetIndex widgetIndex = 0xFFFE;
|
||||
ToolCancel();
|
||||
ToolSet(*toolbarWindow, widgetIndex, static_cast<Tool>(customTool.Cursor));
|
||||
ActiveCustomTool = std::move(customTool);
|
||||
|
||||
Reference in New Issue
Block a user