Remove old calls to invalidate now handled by intent

This commit is contained in:
Michael Bernardi 2023-07-22 22:28:07 +02:00
parent d2b6419055
commit b496e001d1
1 changed files with 7 additions and 114 deletions

View File

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