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 febed0c9c6..ebc4925220 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -8,6 +8,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..c6dbe52856 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -515,25 +515,6 @@ 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) - { - tileElement->SetInvisible(!tileElement->IsInvisible()); - w->Invalidate(); - } -} - static void ShortcutIncreaseElementHeight() { WindowBase* w = WindowFindByClass(WindowClass::TileInspector); @@ -878,7 +859,7 @@ void ShortcutManager::RegisterDefaultShortcuts() RegisterShortcut(ShortcutId::WindowRideConstructionNext, STR_SHORTCUT_CONSTRUCTION_NEXT_TRACK, "NUMPAD 9", WindowRideConstructionKeyboardShortcutNextTrack); RegisterShortcut(ShortcutId::WindowRideConstructionBuild, STR_SHORTCUT_CONSTRUCTION_BUILD_CURRENT, "NUMPAD 0", ShortcutConstructionBuildCurrent); RegisterShortcut(ShortcutId::WindowRideConstructionDemolish, STR_SHORTCUT_CONSTRUCTION_DEMOLISH_CURRENT, "NUMPAD -", ShortcutConstructionDemolishCurrent); - RegisterShortcut(ShortcutId::WindowTileInspectorToggleInvisibility, STR_SHORTCUT_TOGGLE_INVISIBILITY, ShortcutToggleVisibility); + RegisterShortcut(ShortcutId::WindowTileInspectorToggleInvisibility, STR_SHORTCUT_TOGGLE_INVISIBILITY, WindowTileInspectorKeyboardShortcutToggleInvisibility); RegisterShortcut(ShortcutId::WindowTileInspectorCopy, STR_SHORTCUT_COPY_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_COPY)); RegisterShortcut(ShortcutId::WindowTileInspectorPaste, STR_SHORTCUT_PASTE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_PASTE)); RegisterShortcut(ShortcutId::WindowTileInspectorRemove, STR_SHORTCUT_REMOVE_ELEMENT, std::bind(TileInspectorMouseUp, WC_TILE_INSPECTOR__WIDX_BUTTON_REMOVE)); 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);