1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-29 09:44:52 +01:00

Use CoordsXYRangedZ for footpath_remove_edges_towards()

This commit is contained in:
Tulio Leao
2020-01-04 08:52:18 -03:00
parent 09e434bc19
commit 8e0020e5a2

View File

@@ -1966,14 +1966,14 @@ static void footpath_remove_edges_towards_here(
*
* rct2: 0x006A6B14
*/
static void footpath_remove_edges_towards(int32_t x, int32_t y, int32_t z0, int32_t z1, int32_t direction, bool isQueue)
static void footpath_remove_edges_towards(const CoordsXYRangedZ& footPathPos, int32_t direction, bool isQueue)
{
if (!map_is_location_valid({ x, y }))
if (!map_is_location_valid(footPathPos))
{
return;
}
TileElement* tileElement = map_get_first_element_at({ x, y });
TileElement* tileElement = map_get_first_element_at(footPathPos);
if (tileElement == nullptr)
return;
do
@@ -1981,7 +1981,7 @@ static void footpath_remove_edges_towards(int32_t x, int32_t y, int32_t z0, int3
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
continue;
if (z1 == tileElement->base_height)
if (footPathPos.clearanceZ == tileElement->GetBaseZ())
{
if (tileElement->AsPath()->IsSloped())
{
@@ -1989,11 +1989,11 @@ static void footpath_remove_edges_towards(int32_t x, int32_t y, int32_t z0, int3
if (slope != direction)
break;
}
footpath_remove_edges_towards_here({ x, y, z1 * COORDS_Z_STEP}, direction, tileElement, isQueue);
footpath_remove_edges_towards_here({ footPathPos, footPathPos.clearanceZ }, direction, tileElement, isQueue);
break;
}
if (z0 == tileElement->base_height)
if (footPathPos.baseZ == tileElement->GetBaseZ())
{
if (!tileElement->AsPath()->IsSloped())
break;
@@ -2002,7 +2002,7 @@ static void footpath_remove_edges_towards(int32_t x, int32_t y, int32_t z0, int3
if (slope != direction)
break;
footpath_remove_edges_towards_here({ x, y, z1 * COORDS_Z_STEP }, direction, tileElement, isQueue);
footpath_remove_edges_towards_here({ footPathPos, footPathPos.clearanceZ }, direction, tileElement, isQueue);
break;
}
} while (!(tileElement++)->IsLastForTile());
@@ -2167,8 +2167,7 @@ void footpath_remove_edges_at(const CoordsXY& footpathPos, TileElement* tileElem
bool isQueue = tileElement->GetType() == TILE_ELEMENT_TYPE_PATH ? tileElement->AsPath()->IsQueue() : false;
int32_t z0 = z1 - 2;
footpath_remove_edges_towards(
footpathPos.x + CoordsDirectionDelta[direction].x, footpathPos.y + CoordsDirectionDelta[direction].y, z0, z1,
direction, isQueue);
{ footpathPos + CoordsDirectionDelta[direction], z0 * COORDS_Z_STEP, z1 * COORDS_Z_STEP }, direction, isQueue);
}
else
{