diff --git a/src/openrct2-ui/windows/Sign.cpp b/src/openrct2-ui/windows/Sign.cpp index 1671a0b459..1554c83416 100644 --- a/src/openrct2-ui/windows/Sign.cpp +++ b/src/openrct2-ui/windows/Sign.cpp @@ -59,9 +59,14 @@ class SignWindow final : public Window private: bool _isSmall = false; + BannerIndex GetBannerIndex() const + { + return BannerIndex::FromUnderlying(number); + } + void ShowTextInput() { - auto* banner = GetBanner(BannerIndex::FromUnderlying(number)); + auto* banner = GetBanner(GetBannerIndex()); if (banner != nullptr) { auto bannerText = banner->GetText(); @@ -87,14 +92,14 @@ public: { number = windowNumber; _isSmall = isSmall; - auto* banner = GetBanner(BannerIndex::FromUnderlying(number)); + auto* banner = GetBanner(GetBannerIndex()); if (banner == nullptr) { return false; } auto signViewPosition = banner->position.ToCoordsXY().ToTileCentre(); - auto* tileElement = banner_get_tile_element(BannerIndex::FromUnderlying(number)); + auto* tileElement = banner_get_tile_element(GetBannerIndex()); if (tileElement == nullptr) return false; @@ -138,7 +143,7 @@ public: void OnMouseUp(rct_widgetindex widgetIndex) override { - auto* banner = GetBanner(BannerIndex::FromUnderlying(number)); + auto* banner = GetBanner(GetBannerIndex()); if (banner == nullptr) { Close(); @@ -151,7 +156,7 @@ public: break; case WIDX_SIGN_DEMOLISH: { - auto* tileElement = banner_get_tile_element(BannerIndex::FromUnderlying(number)); + auto* tileElement = banner_get_tile_element(GetBannerIndex()); if (tileElement == nullptr) { Close(); @@ -203,8 +208,7 @@ public: if (dropdownIndex == -1) return; list_information_type = dropdownIndex; - auto signSetStyleAction = SignSetStyleAction( - BannerIndex::FromUnderlying(number), dropdownIndex, var_492, !_isSmall); + auto signSetStyleAction = SignSetStyleAction(GetBannerIndex(), dropdownIndex, var_492, !_isSmall); GameActions::Execute(&signSetStyleAction); break; } @@ -213,8 +217,7 @@ public: if (dropdownIndex == -1) return; var_492 = dropdownIndex; - auto signSetStyleAction = SignSetStyleAction( - BannerIndex::FromUnderlying(number), list_information_type, dropdownIndex, !_isSmall); + auto signSetStyleAction = SignSetStyleAction(GetBannerIndex(), list_information_type, dropdownIndex, !_isSmall); GameActions::Execute(&signSetStyleAction); break; } @@ -229,7 +232,7 @@ public: { if (widgetIndex == WIDX_SIGN_TEXT && !text.empty()) { - auto signSetNameAction = SignSetNameAction(BannerIndex::FromUnderlying(number), std::string(text)); + auto signSetNameAction = SignSetNameAction(GetBannerIndex(), std::string(text)); GameActions::Execute(&signSetNameAction); } } @@ -290,7 +293,7 @@ public: { RemoveViewport(); - auto banner = GetBanner(BannerIndex::FromUnderlying(number)); + auto banner = GetBanner(GetBannerIndex()); if (banner == nullptr) { return;