From 2b1101d3201211c4b2c1b6fdc4f7da98fc04cf5f Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sat, 4 Jan 2020 08:10:10 -0300 Subject: [PATCH] Use CoordsXYZ on footpath_interrupt_peeps() --- src/openrct2/actions/FootpathPlaceAction.hpp | 2 +- src/openrct2/actions/FootpathPlaceFromTrackAction.hpp | 2 +- src/openrct2/actions/FootpathRemoveAction.hpp | 2 +- src/openrct2/actions/FootpathSceneryPlaceAction.hpp | 2 +- src/openrct2/actions/FootpathSceneryRemoveAction.hpp | 2 +- src/openrct2/world/Footpath.cpp | 8 ++++---- src/openrct2/world/Footpath.h | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/openrct2/actions/FootpathPlaceAction.hpp b/src/openrct2/actions/FootpathPlaceAction.hpp index 1777b61f16..f72a0f2b67 100644 --- a/src/openrct2/actions/FootpathPlaceAction.hpp +++ b/src/openrct2/actions/FootpathPlaceAction.hpp @@ -117,7 +117,7 @@ public: if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - footpath_interrupt_peeps(_loc.x, _loc.y, _loc.z); + footpath_interrupt_peeps(_loc); } gFootpathGroundFlags = 0; diff --git a/src/openrct2/actions/FootpathPlaceFromTrackAction.hpp b/src/openrct2/actions/FootpathPlaceFromTrackAction.hpp index 397374909f..e0d8b1cbb9 100644 --- a/src/openrct2/actions/FootpathPlaceFromTrackAction.hpp +++ b/src/openrct2/actions/FootpathPlaceFromTrackAction.hpp @@ -98,7 +98,7 @@ public: if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - footpath_interrupt_peeps(_loc.x, _loc.y, _loc.z); + footpath_interrupt_peeps(_loc); } gFootpathGroundFlags = 0; diff --git a/src/openrct2/actions/FootpathRemoveAction.hpp b/src/openrct2/actions/FootpathRemoveAction.hpp index 89d296bb22..5ad5749bbb 100644 --- a/src/openrct2/actions/FootpathRemoveAction.hpp +++ b/src/openrct2/actions/FootpathRemoveAction.hpp @@ -78,7 +78,7 @@ public: if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - footpath_interrupt_peeps(_loc.x, _loc.y, _loc.z); + footpath_interrupt_peeps(_loc); footpath_remove_litter(_loc.x, _loc.y, _loc.z); } diff --git a/src/openrct2/actions/FootpathSceneryPlaceAction.hpp b/src/openrct2/actions/FootpathSceneryPlaceAction.hpp index b5580b8f2e..bdf4feeb73 100644 --- a/src/openrct2/actions/FootpathSceneryPlaceAction.hpp +++ b/src/openrct2/actions/FootpathSceneryPlaceAction.hpp @@ -176,7 +176,7 @@ public: } else { - footpath_interrupt_peeps(_loc.x, _loc.y, _loc.z); + footpath_interrupt_peeps(_loc); } if ((_pathItemType != 0 && !(GetFlags() & GAME_COMMAND_FLAG_GHOST)) diff --git a/src/openrct2/actions/FootpathSceneryRemoveAction.hpp b/src/openrct2/actions/FootpathSceneryRemoveAction.hpp index 1c4ceb225f..92190a1aaa 100644 --- a/src/openrct2/actions/FootpathSceneryRemoveAction.hpp +++ b/src/openrct2/actions/FootpathSceneryRemoveAction.hpp @@ -99,7 +99,7 @@ public: if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { - footpath_interrupt_peeps(_loc.x, _loc.y, _loc.z); + footpath_interrupt_peeps(_loc); } if (pathElement == nullptr) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 282dcf026b..44e3d907d9 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -421,9 +421,9 @@ void footpath_remove_litter(int32_t x, int32_t y, int32_t z) * * rct2: 0x0069A48B */ -void footpath_interrupt_peeps(int32_t x, int32_t y, int32_t z) +void footpath_interrupt_peeps(const CoordsXYZ& footpathPos) { - uint16_t spriteIndex = sprite_get_first_in_quadrant(x, y); + uint16_t spriteIndex = sprite_get_first_in_quadrant(footpathPos.x, footpathPos.y); while (spriteIndex != SPRITE_INDEX_NULL) { Peep* peep = &get_sprite(spriteIndex)->peep; @@ -432,7 +432,7 @@ void footpath_interrupt_peeps(int32_t x, int32_t y, int32_t z) { if (peep->state == PEEP_STATE_SITTING || peep->state == PEEP_STATE_WATCHING) { - if (peep->z == z) + if (peep->z == footpathPos.z) { peep->SetState(PEEP_STATE_WALKING); peep->destination_x = (peep->x & 0xFFE0) + 16; @@ -917,7 +917,7 @@ static void loc_6A6D7E( } if (!(flags & (GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED))) { - footpath_interrupt_peeps(targetPos.x, targetPos.y, tileElement->GetBaseZ()); + footpath_interrupt_peeps({ targetPos, tileElement->GetBaseZ() }); } map_invalidate_element(targetPos, tileElement); } diff --git a/src/openrct2/world/Footpath.h b/src/openrct2/world/Footpath.h index e4a44f2163..00897b36aa 100644 --- a/src/openrct2/world/Footpath.h +++ b/src/openrct2/world/Footpath.h @@ -178,7 +178,7 @@ extern const LocationXY16 BenchUseOffsets[NumOrthogonalDirections * 2]; TileElement* map_get_footpath_element(CoordsXYZ coords); struct PathElement; PathElement* map_get_footpath_element_slope(int32_t x, int32_t y, int32_t z, int32_t slope); -void footpath_interrupt_peeps(int32_t x, int32_t y, int32_t z); +void footpath_interrupt_peeps(const CoordsXYZ& footpathPos); money32 footpath_remove(CoordsXYZ footpathLoc, int32_t flags); money32 footpath_provisional_set(int32_t type, CoordsXYZ footpathLoc, int32_t slope); void footpath_provisional_remove();