diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 7fc738d894..ff4cda1427 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -2407,5 +2407,5 @@ void ShiftMap(const TileCoordsXY& amount) id = BannerIndex::FromUnderlying(id.ToUnderlying() + 1); } - MapAnimations::ShiftAll(amountToMove); + MapAnimations::ShiftAll(amount); } diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index 711748310c..c79c6d65de 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -713,20 +713,18 @@ void MapAnimations::ClearAll() _temporaryMapAnimations.clear(); } -void MapAnimations::ShiftAll(const CoordsXY amount) +void MapAnimations::ShiftAll(const TileCoordsXY amount) { if (amount.x == 0 && amount.y == 0) return; - const auto tileAmount = TileCoordsXY(amount); - std::vector newMapAnimationsInvalidate(_mapAnimationsInvalidate.size(), false); for (int32_t y = 0; y < kMaximumMapSizeTechnical; y++) { for (int32_t x = 0; x < kMaximumMapSizeTechnical; x++) { const bool animated = _mapAnimationsInvalidate[x + (y * kMaximumMapSizeTechnical)]; - const TileCoordsXY newCoords = TileCoordsXY(x, y) + tileAmount; + const TileCoordsXY newCoords = TileCoordsXY(x, y) + amount; if (!MapIsEdge(newCoords.ToCoordsXY())) { newMapAnimationsInvalidate[newCoords.x + (newCoords.y * kMaximumMapSizeTechnical)] = animated; @@ -738,14 +736,14 @@ void MapAnimations::ShiftAll(const CoordsXY amount) std::set newMapAnimationsUpdate; for (const auto a : _mapAnimationsUpdate) { - newMapAnimationsUpdate.insert(a + tileAmount); + newMapAnimationsUpdate.insert(a + amount); } _mapAnimationsUpdate = std::move(newMapAnimationsUpdate); std::set newTemporaryMapAnimations; for (const auto& a : _temporaryMapAnimations) { - newTemporaryMapAnimations.insert(TemporaryMapAnimation{ a.location + CoordsXYZ(amount, 0), a.type }); + newTemporaryMapAnimations.insert(TemporaryMapAnimation{ a.location + CoordsXYZ(amount.ToCoordsXY(), 0), a.type }); } _temporaryMapAnimations = std::move(newTemporaryMapAnimations); } diff --git a/src/openrct2/world/MapAnimation.h b/src/openrct2/world/MapAnimation.h index b36d1265c4..a6a3551f6a 100644 --- a/src/openrct2/world/MapAnimation.h +++ b/src/openrct2/world/MapAnimation.h @@ -24,5 +24,5 @@ namespace OpenRCT2::MapAnimations void MarkAllTiles(); void InvalidateAndUpdateAll(); void ClearAll(); - void ShiftAll(const CoordsXY amount); + void ShiftAll(const TileCoordsXY amount); } // namespace OpenRCT2::MapAnimations