From b496e001d10cbe2dd8f4c9fc820a84c4c95e336a Mon Sep 17 00:00:00 2001 From: Michael Bernardi Date: Sat, 22 Jul 2023 22:28:07 +0200 Subject: [PATCH] Remove old calls to invalidate now handled by intent --- src/openrct2/world/TileInspector.cpp | 121 ++------------------------- 1 file changed, 7 insertions(+), 114 deletions(-) diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 037e9c4a01..5a5d2d7326 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -76,15 +76,11 @@ namespace OpenRCT2::TileInspector return true; } - static WindowBase* GetTileInspectorWithPos(const CoordsXY& loc) + static bool IsTileSelected(const CoordsXY& loc) { - // Return the tile inspector window for everyone who has the tile selected + // Return true for everyone who has the window open and tile selected auto* window = WindowFindByClass(WindowClass::TileInspector); - if (window != nullptr && loc == windowTileInspectorTile.ToCoordsXY()) - { - return window; - } - return nullptr; + return window != nullptr && loc == windowTileInspectorTile.ToCoordsXY(); } static int32_t NumLargeScenerySequences(const CoordsXY& loc, const LargeSceneryElement* const largeScenery) @@ -166,7 +162,7 @@ namespace OpenRCT2::TileInspector TileElementRemove(tileElement); MapInvalidateTileFull(loc); - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) + if (IsTileSelected(loc)) { // Update the window windowTileInspectorElementCount--; @@ -179,8 +175,6 @@ namespace OpenRCT2::TileInspector { windowTileInspectorSelectedIndex = -1; } - - inspector->Invalidate(); } } @@ -197,15 +191,13 @@ namespace OpenRCT2::TileInspector } MapInvalidateTileFull(loc); - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) + if (IsTileSelected(loc)) { // If one of them was selected, update selected list item if (windowTileInspectorSelectedIndex == first) windowTileInspectorSelectedIndex = second; else if (windowTileInspectorSelectedIndex == second) windowTileInspectorSelectedIndex = first; - - inspector->Invalidate(); } } @@ -287,11 +279,6 @@ namespace OpenRCT2::TileInspector } MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -371,7 +358,7 @@ namespace OpenRCT2::TileInspector MapAnimationAutoCreateAtTileElement(tileLoc, pastedElement); MapInvalidateTileFull(loc); - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) + if (IsTileSelected(loc)) { windowTileInspectorElementCount++; @@ -381,8 +368,6 @@ namespace OpenRCT2::TileInspector windowTileInspectorSelectedIndex = newIndex; else if (windowTileInspectorSelectedIndex >= newIndex) windowTileInspectorSelectedIndex++; - - inspector->Invalidate(); } } @@ -435,12 +420,10 @@ namespace OpenRCT2::TileInspector MapInvalidateTileFull(loc); - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) + if (IsTileSelected(loc)) { // Deselect tile for clients who had it selected windowTileInspectorSelectedIndex = -1; - - inspector->Invalidate(); } } @@ -510,11 +493,6 @@ namespace OpenRCT2::TileInspector tileElement->ClearanceHeight += heightOffset; MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -536,11 +514,6 @@ namespace OpenRCT2::TileInspector ParkUpdateFences(loc); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -589,11 +562,6 @@ namespace OpenRCT2::TileInspector surfaceElement->SetSlope(newSlope); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -613,11 +581,6 @@ namespace OpenRCT2::TileInspector surfaceElement->SetSlope(newSlope); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -634,11 +597,6 @@ namespace OpenRCT2::TileInspector pathElement->AsPath()->SetSloped(sloped); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -656,11 +614,6 @@ namespace OpenRCT2::TileInspector pathElement->AsPath()->SetJunctionRailings(hasJunctionRailings); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -677,11 +630,6 @@ namespace OpenRCT2::TileInspector pathElement->AsPath()->SetIsBroken(broken); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -699,11 +647,6 @@ namespace OpenRCT2::TileInspector pathElement->AsPath()->SetEdgesAndCorners(newEdges); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -733,11 +676,6 @@ namespace OpenRCT2::TileInspector station.Exit = { loc, entranceElement->BaseHeight, entranceElement->GetDirection() }; break; } - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -755,11 +693,6 @@ namespace OpenRCT2::TileInspector wallElement->AsWall()->SetSlope(slopeValue); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -778,11 +711,6 @@ namespace OpenRCT2::TileInspector wallElement->AsWall()->SetAnimationFrame(animationFrame + animationFrameOffset); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -852,11 +780,6 @@ namespace OpenRCT2::TileInspector tileElement->BaseHeight += offset; tileElement->ClearanceHeight += offset; } - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -938,11 +861,6 @@ namespace OpenRCT2::TileInspector tileElement->AsTrack()->SetHasChain(setChain); } } - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -959,11 +877,6 @@ namespace OpenRCT2::TileInspector trackElement->AsTrack()->SetBrakeClosed(isClosed); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -981,11 +894,6 @@ namespace OpenRCT2::TileInspector trackElement->AsTrack()->SetIsIndestructible(isIndestructible); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -1007,11 +915,6 @@ namespace OpenRCT2::TileInspector tileElement->SetOccupiedQuadrants(1 << ((quarterIndex + 2) & 3)); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -1031,11 +934,6 @@ namespace OpenRCT2::TileInspector tileElement->SetOccupiedQuadrants(occupiedQuadrants); MapInvalidateTileFull(loc); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result(); @@ -1052,11 +950,6 @@ namespace OpenRCT2::TileInspector uint8_t edges = bannerElement->AsBanner()->GetAllowedEdges(); edges ^= (1 << edgeIndex); bannerElement->AsBanner()->SetAllowedEdges(edges); - - if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) - { - inspector->Invalidate(); - } } return GameActions::Result();