mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 03:23:15 +01:00
Change MapAnimations::ShiftAll parameter from CoordsXY to TileCoordsXY
This commit is contained in:
@@ -2407,5 +2407,5 @@ void ShiftMap(const TileCoordsXY& amount)
|
||||
id = BannerIndex::FromUnderlying(id.ToUnderlying() + 1);
|
||||
}
|
||||
|
||||
MapAnimations::ShiftAll(amountToMove);
|
||||
MapAnimations::ShiftAll(amount);
|
||||
}
|
||||
|
||||
@@ -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<bool> 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<TileCoordsXY, TileCoordsXYCmp> newMapAnimationsUpdate;
|
||||
for (const auto a : _mapAnimationsUpdate)
|
||||
{
|
||||
newMapAnimationsUpdate.insert(a + tileAmount);
|
||||
newMapAnimationsUpdate.insert(a + amount);
|
||||
}
|
||||
_mapAnimationsUpdate = std::move(newMapAnimationsUpdate);
|
||||
|
||||
std::set<TemporaryMapAnimation> 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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user