From 95169f9632cd0b5968ff8c8d65f5c66027a61a7f Mon Sep 17 00:00:00 2001 From: fidwell <5436387+fidwell@users.noreply.github.com> Date: Mon, 2 Oct 2023 22:24:04 -0400 Subject: [PATCH] Tile inspector invisibility shortcut does not use a game action --- contributors.md | 2 +- distribution/changelog.txt | 1 + src/openrct2-ui/input/Shortcuts.cpp | 16 +++------------- src/openrct2-ui/windows/TileInspector.cpp | 15 +++++++++++++++ src/openrct2/interface/Window.h | 2 ++ 5 files changed, 22 insertions(+), 14 deletions(-) diff --git a/contributors.md b/contributors.md index f57abd208b..b41c9c0d06 100644 --- a/contributors.md +++ b/contributors.md @@ -102,7 +102,7 @@ The following people are not part of the development team, but have been contrib * Karst van Galen Last (AuraSpecs) - Ride paint (bounding boxes, extra track pieces), soundtrack, sound effects, misc. * (8street) - Misc. * Umar Ahmed (umar-ahmed) - MacOS file watcher -* Andrew Arnold (fidwell) - Added window support for more scenery groups. +* Andrew Arnold (fidwell) - Misc. * Josh Trzebiatowski (trzejos) - Ride and scenery filtering * (kyphii) - Extended color selection, reversed ride vehicles, misc. * Phumdol Lookthipnapha (beam41) - Misc. diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 9bcf5ba87c..842d4c5818 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -7,6 +7,7 @@ - Fix: [#20737] Spent money in player window underflows when getting refunds. - Fix: [#20778] [Plugin] Incorrect target api when executing custom actions. - Fix: [#19722] “Forbid tree removal” restriction doesn't forbid removal of large scenery tree items. +- Fix: [#16453] Tile inspector invisibility shortcut does not use a game action. 0.4.6 (2023-09-03) ------------------------------------------------------------------------ diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index 437e4d0efd..439077be51 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -517,20 +517,10 @@ static void TileInspectorMouseDown(WidgetIndex widgetIndex) static void ShortcutToggleVisibility() { - // TODO: Once the tile inspector window has its own class, move this to its own function - if (windowTileInspectorSelectedIndex < 0) - return; - - WindowBase* w = WindowFindByClass(WindowClass::TileInspector); - if (w == nullptr) - return; - - extern TileCoordsXY windowTileInspectorTile; - TileElement* tileElement = MapGetNthElementAt(windowTileInspectorTile.ToCoordsXY(), windowTileInspectorSelectedIndex); - if (tileElement != nullptr) + WindowBase* window = WindowFindByClass(WindowClass::TileInspector); + if (window != nullptr) { - tileElement->SetInvisible(!tileElement->IsInvisible()); - w->Invalidate(); + WindowTileInspectorKeyboardShortcutToggleInvisibility(); } } diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 735d857a0a..6aca36ecca 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1697,6 +1697,14 @@ public: _elementCopied = false; } + void ToggleInvisibility() + { + if (windowTileInspectorSelectedIndex >= 0 && windowTileInspectorSelectedIndex < windowTileInspectorElementCount) + { + ToggleInvisibility(windowTileInspectorSelectedIndex); + } + } + private: void SetPage(const TileInspectorPage p) { @@ -2369,3 +2377,10 @@ void WindowTileInspectorClearClipboard() if (window != nullptr) static_cast(window)->ClearClipboard(); } + +void WindowTileInspectorKeyboardShortcutToggleInvisibility() +{ + auto* window = WindowFindByClass(WindowClass::TileInspector); + if (window != nullptr) + static_cast(window)->ToggleInvisibility(); +} diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 95d38b9046..05feffa7a9 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -680,6 +680,8 @@ void WindowFootpathKeyboardShortcutSlopeUp(); void WindowFootpathKeyboardShortcutBuildCurrent(); void WindowFootpathKeyboardShortcutDemolishCurrent(); +void WindowTileInspectorKeyboardShortcutToggleInvisibility(); + void WindowFollowSprite(WindowBase& w, EntityId spriteIndex); void WindowUnfollowSprite(WindowBase& w);