Rename member of WidgetIdentifier and WidgetRef

This commit is contained in:
Gymnasiast committed 2025-09-17 20:10:12 +02:00
1 parent 2a792987a7
commit 8a7a265639
12 files changed
+107 -108

No files matched your search

+58 -58
View File
@@ -184,9 +184,9 @@ namespace OpenRCT2
{
_inputState = InputState::ScrollRight;
gInputDragLast = screenCoords;
_dragWidget.window_classification = w->classification;
_dragWidget.window_number = w->number;
_dragWidget.widget_index = widgetIndex;
_dragWidget.windowClassification = w->classification;
_dragWidget.windowNumber = w->number;
_dragWidget.widgetIndex = widgetIndex;
_ticksSinceDragStart = gCurrentRealTimeTicks;
_dragScrollIndex = WindowGetScrollDataIndex(*w, widgetIndex);
@@ -199,7 +199,7 @@ namespace OpenRCT2
*/
static void InputScrollDragContinue(const ScreenCoordsXY& screenCoords, WindowBase* w)
{
WidgetIndex widgetIndex = _dragWidget.widget_index;
WidgetIndex widgetIndex = _dragWidget.widgetIndex;
uint8_t scrollIndex = _dragScrollIndex;
const auto& widget = w->widgets[widgetIndex];
@@ -247,7 +247,7 @@ namespace OpenRCT2
static void InputScrollRight(const ScreenCoordsXY& screenCoords, MouseState state)
{
auto* windowMgr = GetWindowManager();
WindowBase* w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
WindowBase* w = windowMgr->FindByNumber(_dragWidget.windowClassification, _dragWidget.windowNumber);
if (w == nullptr)
{
ContextShowCursor();
@@ -344,7 +344,7 @@ namespace OpenRCT2
InputStateWidgetPressed(screenCoords, state, widgetIndex, w, widget);
break;
case InputState::PositioningWindow:
w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
w = windowMgr->FindByNumber(_dragWidget.windowClassification, _dragWidget.windowNumber);
if (w == nullptr)
{
_inputState = InputState::Reset;
@@ -377,7 +377,7 @@ namespace OpenRCT2
InputStateWidgetPressed(screenCoords, state, widgetIndex, w, widget);
break;
case InputState::ViewportLeft:
w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
w = windowMgr->FindByNumber(_dragWidget.windowClassification, _dragWidget.windowNumber);
if (w == nullptr)
{
_inputState = InputState::Reset;
@@ -396,31 +396,31 @@ namespace OpenRCT2
if (!gInputFlags.has(InputFlag::leftMousePressed))
break;
if (w->classification != _dragWidget.window_classification || w->number != _dragWidget.window_number
if (w->classification != _dragWidget.windowClassification || w->number != _dragWidget.windowNumber
|| !(gInputFlags.has(InputFlag::toolActive)))
{
break;
}
w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
w = windowMgr->FindByNumber(gCurrentToolWidget.windowClassification, gCurrentToolWidget.windowNumber);
if (w == nullptr)
{
break;
}
w->OnToolDrag(gCurrentToolWidget.widget_index, screenCoords);
w->OnToolDrag(gCurrentToolWidget.widgetIndex, screenCoords);
break;
case MouseState::LeftRelease:
_inputState = InputState::Reset;
if (_dragWidget.window_number == w->number)
if (_dragWidget.windowNumber == w->number)
{
if (gInputFlags.has(InputFlag::toolActive))
{
w = windowMgr->FindByNumber(
gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
gCurrentToolWidget.windowClassification, gCurrentToolWidget.windowNumber);
if (w != nullptr)
{
w->OnToolUp(gCurrentToolWidget.widget_index, screenCoords);
w->OnToolUp(gCurrentToolWidget.widgetIndex, screenCoords);
}
}
else if (!gInputFlags.has(InputFlag::leftMousePressed))
@@ -453,7 +453,7 @@ namespace OpenRCT2
}
break;
case InputState::Resizing:
w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
w = windowMgr->FindByNumber(_dragWidget.windowClassification, _dragWidget.windowNumber);
if (w == nullptr)
{
_inputState = InputState::Reset;
@@ -482,9 +482,9 @@ namespace OpenRCT2
{
_inputState = InputState::PositioningWindow;
gInputDragLast = screenCoords - w.windowPos;
_dragWidget.window_classification = w.classification;
_dragWidget.window_number = w.number;
_dragWidget.widget_index = widgetIndex;
_dragWidget.windowClassification = w.classification;
_dragWidget.windowNumber = w.number;
_dragWidget.widgetIndex = widgetIndex;
}
static void InputWindowPositionContinue(
@@ -508,9 +508,9 @@ namespace OpenRCT2
{
_inputState = InputState::Resizing;
gInputDragLast = screenCoords;
_dragWidget.window_classification = w.classification;
_dragWidget.window_number = w.number;
_dragWidget.widget_index = widgetIndex;
_dragWidget.windowClassification = w.classification;
_dragWidget.windowNumber = w.number;
_dragWidget.widgetIndex = widgetIndex;
_originalWindowWidth = w.width;
_originalWindowHeight = w.height;
}
@@ -542,8 +542,8 @@ namespace OpenRCT2
{
w.flags &= ~WF_SCROLLING_TO_LOCATION;
_inputState = InputState::ViewportRight;
_dragWidget.window_classification = w.classification;
_dragWidget.window_number = w.number;
_dragWidget.windowClassification = w.classification;
_dragWidget.windowNumber = w.number;
_ticksSinceDragStart = gCurrentRealTimeTicks;
auto cursorPosition = ContextGetCursorPosition();
gInputDragLast = cursorPosition;
@@ -573,7 +573,7 @@ namespace OpenRCT2
return;
auto* windowMgr = GetWindowManager();
w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
w = windowMgr->FindByNumber(_dragWidget.windowClassification, _dragWidget.windowNumber);
// #3294: Window can be closed during a drag session, so just finish
// the session if the window no longer exists
@@ -649,9 +649,9 @@ namespace OpenRCT2
const auto& widget = w.widgets[widgetIndex];
_inputState = InputState::ScrollLeft;
gPressedWidget.window_classification = w.classification;
gPressedWidget.window_number = w.number;
gPressedWidget.widget_index = widgetIndex;
gPressedWidget.windowClassification = w.classification;
gPressedWidget.windowNumber = w.number;
gPressedWidget.widgetIndex = widgetIndex;
gTooltipCursor = screenCoords;
int32_t scroll_area, scroll_id;
@@ -721,8 +721,8 @@ namespace OpenRCT2
int32_t scroll_part, scroll_id;
const auto& widget = w.widgets[widgetIndex];
if (w.classification != gPressedWidget.window_classification || w.number != gPressedWidget.window_number
|| widgetIndex != gPressedWidget.widget_index)
if (w.classification != gPressedWidget.windowClassification || w.number != gPressedWidget.windowNumber
|| widgetIndex != gPressedWidget.widgetIndex)
{
InvalidateScroll();
return;
@@ -1000,16 +1000,16 @@ namespace OpenRCT2
return;
// Check if the widget that the cursor was over, has changed
if (windowClass != gHoverWidget.window_classification || windowNumber != gHoverWidget.window_number
|| widgetIndex != gHoverWidget.widget_index)
if (windowClass != gHoverWidget.windowClassification || windowNumber != gHoverWidget.windowNumber
|| widgetIndex != gHoverWidget.widgetIndex)
{
// Invalidate last widget cursor was on if widget is a flat button
InputWidgetOverFlatbuttonInvalidate();
// Set new cursor over widget
gHoverWidget.window_classification = windowClass;
gHoverWidget.window_number = windowNumber;
gHoverWidget.widget_index = widgetIndex;
gHoverWidget.windowClassification = windowClass;
gHoverWidget.windowNumber = windowNumber;
gHoverWidget.widgetIndex = widgetIndex;
// Invalidate new widget cursor is on if widget is a flat button
if (windowClass != WindowClass::Null)
@@ -1024,14 +1024,14 @@ namespace OpenRCT2
static void InputWidgetOverFlatbuttonInvalidate()
{
auto* windowMgr = GetWindowManager();
WindowBase* w = windowMgr->FindByNumber(gHoverWidget.window_classification, gHoverWidget.window_number);
WindowBase* w = windowMgr->FindByNumber(gHoverWidget.windowClassification, gHoverWidget.windowNumber);
if (w != nullptr)
{
w->OnPrepareDraw();
if (w->widgets[gHoverWidget.widget_index].type == WidgetType::flatBtn)
if (w->widgets[gHoverWidget.widgetIndex].type == WidgetType::flatBtn)
{
windowMgr->InvalidateWidgetByNumber(
gHoverWidget.window_classification, gHoverWidget.window_number, gHoverWidget.widget_index);
gHoverWidget.windowClassification, gHoverWidget.windowNumber, gHoverWidget.widgetIndex);
}
}
}
@@ -1065,7 +1065,7 @@ namespace OpenRCT2
return;
if (windowClass != GetCurrentTextBox().window.classification || windowNumber != GetCurrentTextBox().window.number
|| widgetIndex != GetCurrentTextBox().widget_index)
|| widgetIndex != GetCurrentTextBox().widgetIndex)
{
WindowCancelTextbox();
}
@@ -1083,15 +1083,15 @@ namespace OpenRCT2
case WidgetType::viewport:
_inputState = InputState::ViewportLeft;
gInputDragLast = screenCoords;
_dragWidget.window_classification = windowClass;
_dragWidget.window_number = windowNumber;
_dragWidget.windowClassification = windowClass;
_dragWidget.windowNumber = windowNumber;
if (gInputFlags.has(InputFlag::toolActive))
{
w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
w = windowMgr->FindByNumber(gCurrentToolWidget.windowClassification, gCurrentToolWidget.windowNumber);
if (w != nullptr)
{
gInputFlags.set(InputFlag::leftMousePressed);
w->OnToolDown(gCurrentToolWidget.widget_index, screenCoords);
w->OnToolDown(gCurrentToolWidget.widgetIndex, screenCoords);
}
}
break;
@@ -1128,9 +1128,9 @@ namespace OpenRCT2
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::Click1, 0, w->windowPos.x + widget.midX());
// Set new cursor down widget
gPressedWidget.window_classification = windowClass;
gPressedWidget.window_number = windowNumber;
gPressedWidget.widget_index = widgetIndex;
gPressedWidget.windowClassification = windowClass;
gPressedWidget.windowNumber = windowNumber;
gPressedWidget.widgetIndex = widgetIndex;
gInputFlags.set(InputFlag::widgetPressed);
_inputState = InputState::WidgetPressed;
_clickRepeatTicks = gCurrentRealTimeTicks;
@@ -1229,12 +1229,12 @@ namespace OpenRCT2
if (gInputFlags.has(InputFlag::toolActive))
{
auto* windowMgr = GetWindowManager();
WindowBase* w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
WindowBase* w = windowMgr->FindByNumber(gCurrentToolWidget.windowClassification, gCurrentToolWidget.windowNumber);
if (w == nullptr)
ToolCancel();
else if (InputGetState() != InputState::ViewportRight)
w->OnToolUpdate(gCurrentToolWidget.widget_index, screenCoords);
w->OnToolUpdate(gCurrentToolWidget.widgetIndex, screenCoords);
}
}
@@ -1247,9 +1247,9 @@ namespace OpenRCT2
{
WindowClass cursor_w_class;
rct_windownumber cursor_w_number;
cursor_w_class = gPressedWidget.window_classification;
cursor_w_number = gPressedWidget.window_number;
WidgetIndex cursor_widgetIndex = gPressedWidget.widget_index;
cursor_w_class = gPressedWidget.windowClassification;
cursor_w_number = gPressedWidget.windowNumber;
WidgetIndex cursor_widgetIndex = gPressedWidget.widgetIndex;
auto* windowMgr = GetWindowManager();
WindowBase* cursor_w = windowMgr->FindByNumber(cursor_w_class, cursor_w_number);
@@ -1386,9 +1386,9 @@ namespace OpenRCT2
_inputState = InputState::Normal;
gTooltipCloseTimeout = 0;
gTooltipWidget.widget_index = cursor_widgetIndex;
gTooltipWidget.window_classification = cursor_w_class;
gTooltipWidget.window_number = cursor_w_number;
gTooltipWidget.widgetIndex = cursor_widgetIndex;
gTooltipWidget.windowClassification = cursor_w_class;
gTooltipWidget.windowNumber = cursor_w_number;
if (dropdown_index == -1)
{
@@ -1410,7 +1410,7 @@ namespace OpenRCT2
}
gTooltipCloseTimeout = 0;
gTooltipWidget.widget_index = cursor_widgetIndex;
gTooltipWidget.widgetIndex = cursor_widgetIndex;
if (w == nullptr)
break;
@@ -1498,7 +1498,7 @@ namespace OpenRCT2
static void InputUpdateTooltip(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords)
{
if (gTooltipWidget.window_classification == WindowClass::Null)
if (gTooltipWidget.windowClassification == WindowClass::Null)
{
if (gTooltipCursor == screenCoords)
{
@@ -1522,8 +1522,8 @@ namespace OpenRCT2
gTooltipCursor = screenCoords;
ResetTooltipNotShown();
if (w == nullptr || gTooltipWidget.window_classification != w->classification
|| gTooltipWidget.window_number != w->number || gTooltipWidget.widget_index != widgetIndex
if (w == nullptr || gTooltipWidget.windowClassification != w->classification
|| gTooltipWidget.windowNumber != w->number || gTooltipWidget.widgetIndex != widgetIndex
|| !widgetIsVisible(*w, widgetIndex))
{
WindowTooltipClose();
@@ -1560,12 +1560,12 @@ namespace OpenRCT2
void InvalidateScroll()
{
auto* windowMgr = GetWindowManager();
WindowBase* w = windowMgr->FindByNumber(gPressedWidget.window_classification, gPressedWidget.window_number);
WindowBase* w = windowMgr->FindByNumber(gPressedWidget.windowClassification, gPressedWidget.windowNumber);
if (w != nullptr)
{
// Reset to basic scroll
w->scrolls[_currentScrollIndex].flags &= 0xFF11;
windowMgr->InvalidateByNumber(gPressedWidget.window_classification, gPressedWidget.window_number);
windowMgr->InvalidateByNumber(gPressedWidget.windowClassification, gPressedWidget.windowNumber);
}
}
+7 -7
View File
@@ -902,11 +902,11 @@ namespace OpenRCT2::Ui
{
if (!gInputFlags.has(InputFlag::widgetPressed))
return false;
if (gPressedWidget.window_classification != w.classification)
if (gPressedWidget.windowClassification != w.classification)
return false;
if (gPressedWidget.window_number != w.number)
if (gPressedWidget.windowNumber != w.number)
return false;
if (gPressedWidget.widget_index != widgetIndex)
if (gPressedWidget.widgetIndex != widgetIndex)
return false;
return true;
}
@@ -915,11 +915,11 @@ namespace OpenRCT2::Ui
bool widgetIsHighlighted(const WindowBase& w, WidgetIndex widgetIndex)
{
if (gHoverWidget.window_classification != w.classification)
if (gHoverWidget.windowClassification != w.classification)
return false;
if (gHoverWidget.window_number != w.number)
if (gHoverWidget.windowNumber != w.number)
return false;
if (gHoverWidget.widget_index != widgetIndex)
if (gHoverWidget.widgetIndex != widgetIndex)
return false;
return true;
}
@@ -1126,7 +1126,7 @@ namespace OpenRCT2::Ui
auto& tbIdent = OpenRCT2::Ui::Windows::GetCurrentTextBox();
bool active = w.classification == tbIdent.window.classification && w.number == tbIdent.window.number
&& widgetIndex == tbIdent.widget_index;
&& widgetIndex == tbIdent.widgetIndex;
// GfxFillRectInset(rt, l, t, r, b, colour, 0x20 | (!active ? 0x40 : 0x00));
GfxFillRectInset(rt, { topLeft, bottomRight }, w.colours[widget.colour], INSET_RECT_F_60);
+5 -5
View File
@@ -560,7 +560,7 @@ namespace OpenRCT2::Ui::Windows
_usingWidgetTextBox = true;
_currentTextBox.window.classification = callW.classification;
_currentTextBox.window.number = callW.number;
_currentTextBox.widget_index = callWidget;
_currentTextBox.widgetIndex = callWidget;
_textBoxFrameNo = 0;
auto* windowMgr = Ui::GetWindowManager();
@@ -583,9 +583,9 @@ namespace OpenRCT2::Ui::Windows
_usingWidgetTextBox = false;
if (w != nullptr)
{
windowMgr->InvalidateWidget(*w, _currentTextBox.widget_index);
windowMgr->InvalidateWidget(*w, _currentTextBox.widgetIndex);
}
_currentTextBox.widget_index = kWidgetIndexNull;
_currentTextBox.widgetIndex = kWidgetIndexNull;
}
}
@@ -603,8 +603,8 @@ namespace OpenRCT2::Ui::Windows
_textBoxFrameNo = 0;
auto* windowMgr = GetWindowManager();
WindowBase* w = windowMgr->FindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number);
windowMgr->InvalidateWidget(*w, _currentTextBox.widget_index);
w->OnTextInput(_currentTextBox.widget_index, _textBoxInput);
windowMgr->InvalidateWidget(*w, _currentTextBox.widgetIndex);
w->OnTextInput(_currentTextBox.widgetIndex, _textBoxInput);
}
}
const TextInputSession* GetTextboxSession()
@@ -352,8 +352,8 @@ namespace OpenRCT2::Ui::Windows
windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 6, widgets[WIDX_PREVIOUS_IMAGE].top + 6 });
colour_t textColour = colours[1].colour;
if (gHoverWidget.window_classification == WindowClass::BottomToolbar
&& gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON)
if (gHoverWidget.windowClassification == WindowClass::BottomToolbar
&& gHoverWidget.widgetIndex == WIDX_PREVIOUS_STEP_BUTTON)
{
textColour = COLOUR_WHITE;
}
@@ -391,8 +391,8 @@ namespace OpenRCT2::Ui::Windows
colour_t textColour = colours[1].colour;
if (gHoverWidget.window_classification == WindowClass::BottomToolbar
&& gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON)
if (gHoverWidget.windowClassification == WindowClass::BottomToolbar
&& gHoverWidget.widgetIndex == WIDX_NEXT_STEP_BUTTON)
{
textColour = COLOUR_WHITE;
}
@@ -487,7 +487,7 @@ namespace OpenRCT2::Ui::Windows
auto& widget = widgets[widgetIndex];
if (widgetIndex == WIDX_PRE_RESEARCHED_SCROLL || widgetIndex == WIDX_RESEARCH_ORDER_SCROLL)
{
gPressedWidget.widget_index = widgetIndex;
gPressedWidget.widgetIndex = widgetIndex;
int32_t outScrollArea{};
ScreenCoordsXY outScrollCoords{};
int32_t outScrollId{};
@@ -280,13 +280,13 @@ namespace OpenRCT2::Ui::Windows
void OnClose() override
{
if (gCurrentToolWidget.window_classification == classification)
if (gCurrentToolWidget.windowClassification == classification)
ToolCancel();
}
void OnUpdate() override
{
if (gCurrentToolWidget.window_classification != classification)
if (gCurrentToolWidget.windowClassification != classification)
Close();
}
@@ -80,7 +80,7 @@ namespace OpenRCT2::Ui::Windows
colour_t GetHoverWidgetColour(WidgetIndex index)
{
return (
gHoverWidget.window_classification == WindowClass::BottomToolbar && gHoverWidget.widget_index == index
gHoverWidget.windowClassification == WindowClass::BottomToolbar && gHoverWidget.widgetIndex == index
? static_cast<colour_t>(COLOUR_WHITE)
: colours[0].colour);
}
+3 -3
View File
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows
{
_parentWidget.window.classification = WindowClass::Null;
_parentWidget.window.number = 0;
_parentWidget.widget_index = 0;
_parentWidget.widgetIndex = 0;
colours[0] = COLOUR_GREY;
colours[1] = COLOUR_GREY;
@@ -83,7 +83,7 @@ namespace OpenRCT2::Ui::Windows
{
_parentWidget.window.classification = parentWindow->classification;
_parentWidget.window.number = parentWindow->number;
_parentWidget.widget_index = widgetIndex;
_parentWidget.widgetIndex = widgetIndex;
colours[0] = parentWindow->colours[1];
colours[1] = parentWindow->colours[1];
@@ -329,7 +329,7 @@ namespace OpenRCT2::Ui::Windows
auto w = GetParentWindow();
if (w != nullptr)
{
w->OnTextInput(_parentWidget.widget_index, _buffer);
w->OnTextInput(_parentWidget.widgetIndex, _buffer);
}
}
}
+8 -8
View File
@@ -153,7 +153,7 @@ namespace OpenRCT2::Ui::Windows
{
gTooltipCursor = screenCoords;
gTooltipCloseTimeout = 0;
gTooltipWidget.window_classification = WindowClass::Null;
gTooltipWidget.windowClassification = WindowClass::Null;
InputSetState(InputState::Normal);
gInputFlags.unset(InputFlag::leftMousePressed);
}
@@ -190,16 +190,16 @@ namespace OpenRCT2::Ui::Windows
result.args = Formatter();
result.args.Add<const char*>(tooltipString);
gTooltipWidget.window_classification = widgetWindow->classification;
gTooltipWidget.window_number = widgetWindow->number;
gTooltipWidget.widget_index = widgetIndex;
gTooltipWidget.windowClassification = widgetWindow->classification;
gTooltipWidget.windowNumber = widgetWindow->number;
gTooltipWidget.widgetIndex = widgetIndex;
}
else
{
auto stringId = widget->tooltip;
gTooltipWidget.window_classification = widgetWindow->classification;
gTooltipWidget.window_number = widgetWindow->number;
gTooltipWidget.widget_index = widgetIndex;
gTooltipWidget.windowClassification = widgetWindow->classification;
gTooltipWidget.windowNumber = widgetWindow->number;
gTooltipWidget.widgetIndex = widgetIndex;
result = widgetWindow->OnTooltip(widgetIndex, stringId);
if (result.str == kStringIdNone)
return;
@@ -214,6 +214,6 @@ namespace OpenRCT2::Ui::Windows
windowMgr->CloseByClass(WindowClass::Tooltip);
gTooltipCloseTimeout = 0;
gTooltipWidget.window_classification = WindowClass::Null;
gTooltipWidget.windowClassification = WindowClass::Null;
}
} // namespace OpenRCT2::Ui::Windows
+1 -1
View File
@@ -105,7 +105,7 @@ namespace OpenRCT2
// ?
gInputFlags.clearAll();
InputSetState(InputState::Reset);
gPressedWidget.window_classification = WindowClass::Null;
gPressedWidget.windowClassification = WindowClass::Null;
gPickupPeepImage = ImageId();
ResetTooltipNotShown();
gMapSelectFlags.clearAll();
+13 -14
View File
@@ -629,22 +629,22 @@ static constexpr float kWindowScrollLocations[][2] = {
bool isToolActive(WindowClass cls)
{
return gInputFlags.has(InputFlag::toolActive) && gCurrentToolWidget.window_classification == cls;
return gInputFlags.has(InputFlag::toolActive) && gCurrentToolWidget.windowClassification == cls;
}
bool isToolActive(WindowClass cls, rct_windownumber number)
{
return isToolActive(cls) && gCurrentToolWidget.window_number == number;
return isToolActive(cls) && gCurrentToolWidget.windowNumber == number;
}
bool isToolActive(WindowClass cls, WidgetIndex widgetIndex)
{
return isToolActive(cls) && gCurrentToolWidget.widget_index == widgetIndex;
return isToolActive(cls) && gCurrentToolWidget.widgetIndex == widgetIndex;
}
bool isToolActive(WindowClass cls, WidgetIndex widgetIndex, rct_windownumber number)
{
return isToolActive(cls, widgetIndex) && gCurrentToolWidget.window_number == number;
return isToolActive(cls, widgetIndex) && gCurrentToolWidget.windowNumber == number;
}
bool isToolActive(const WindowBase& w, WidgetIndex widgetIndex)
@@ -664,8 +664,8 @@ static constexpr float kWindowScrollLocations[][2] = {
{
if (gInputFlags.has(InputFlag::toolActive))
{
if (w.classification == gCurrentToolWidget.window_classification && w.number == gCurrentToolWidget.window_number
&& widgetIndex == gCurrentToolWidget.widget_index)
if (w.classification == gCurrentToolWidget.windowClassification && w.number == gCurrentToolWidget.windowNumber
&& widgetIndex == gCurrentToolWidget.widgetIndex)
{
ToolCancel();
return true;
@@ -678,9 +678,9 @@ static constexpr float kWindowScrollLocations[][2] = {
gInputFlags.unset(InputFlag::leftMousePressed);
gInputFlags.unset(InputFlag::unk6);
gCurrentToolId = tool;
gCurrentToolWidget.window_classification = w.classification;
gCurrentToolWidget.window_number = w.number;
gCurrentToolWidget.widget_index = widgetIndex;
gCurrentToolWidget.windowClassification = w.classification;
gCurrentToolWidget.windowNumber = w.number;
gCurrentToolWidget.widgetIndex = widgetIndex;
return false;
}
@@ -700,20 +700,19 @@ static constexpr float kWindowScrollLocations[][2] = {
// Reset map selection
gMapSelectFlags.clearAll();
if (gCurrentToolWidget.widget_index != kWidgetIndexNull)
if (gCurrentToolWidget.widgetIndex != kWidgetIndexNull)
{
auto* windowMgr = Ui::GetWindowManager();
// Invalidate tool widget
windowMgr->InvalidateWidgetByNumber(
gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number,
gCurrentToolWidget.widget_index);
gCurrentToolWidget.windowClassification, gCurrentToolWidget.windowNumber, gCurrentToolWidget.widgetIndex);
// Abort tool event
WindowBase* w = windowMgr->FindByNumber(
gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
gCurrentToolWidget.windowClassification, gCurrentToolWidget.windowNumber);
if (w != nullptr)
w->OnToolAbort(gCurrentToolWidget.widget_index);
w->OnToolAbort(gCurrentToolWidget.widgetIndex);
}
}
}
+4 -4
View File
@@ -47,7 +47,7 @@ namespace OpenRCT2
struct WidgetIdentifier
{
WindowIdentifier window;
WidgetIndex widget_index;
WidgetIndex widgetIndex;
};
extern WindowCloseModifier gLastCloseModifier;
@@ -266,9 +266,9 @@ namespace OpenRCT2
{
struct WidgetRef
{
WindowClass window_classification;
rct_windownumber window_number;
WidgetIndex widget_index;
WindowClass windowClassification;
rct_windownumber windowNumber;
WidgetIndex widgetIndex;
};
extern Tool gCurrentToolId;