Merge pull request #20840 from fidwell/invisibility-shortcut

Fix #16453: Tile inspector invisibility shortcut does not use a game action
This commit is contained in:
Matt 2023-10-07 23:03:27 +03:00 committed by GitHub
commit 9b7ce95c05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 21 deletions

View File

@ -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.

View File

@ -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)
------------------------------------------------------------------------

View File

@ -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));

View File

@ -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<TileInspector*>(window)->ClearClipboard();
}
void WindowTileInspectorKeyboardShortcutToggleInvisibility()
{
auto* window = WindowFindByClass(WindowClass::TileInspector);
if (window != nullptr)
static_cast<TileInspector*>(window)->ToggleInvisibility();
}

View File

@ -680,6 +680,8 @@ void WindowFootpathKeyboardShortcutSlopeUp();
void WindowFootpathKeyboardShortcutBuildCurrent();
void WindowFootpathKeyboardShortcutDemolishCurrent();
void WindowTileInspectorKeyboardShortcutToggleInvisibility();
void WindowFollowSprite(WindowBase& w, EntityId spriteIndex);
void WindowUnfollowSprite(WindowBase& w);