mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 17:42:29 +01:00
Refactor peep check for vehicle
This commit is contained in:
@@ -5248,12 +5248,14 @@ void rct_peep::UpdateWalking()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rct_tile_element * path_element = map_get_path_element_at(destination_x / 32, destination_y / 32, next_z);
|
// Check if vehicle is blocking the destination tile
|
||||||
if (path_element && path_element->flags & TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE)
|
auto curPos = TileCoordsXYZ(CoordsXYZ { x, y, z });
|
||||||
|
auto dstPos = TileCoordsXYZ(CoordsXY { destination_x, destination_y }, next_z);
|
||||||
|
if (curPos.x != dstPos.x || curPos.y != dstPos.y)
|
||||||
{
|
{
|
||||||
if (!(x >> 5 == destination_x >> 5 &&
|
if (footpath_is_blocked_by_vehicle(dstPos))
|
||||||
y >> 5 == destination_y >> 5))
|
|
||||||
{
|
{
|
||||||
|
// Wait for vehicle to pass
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2178,6 +2178,12 @@ void footpath_update_path_wide_flags(sint32 x, sint32 y)
|
|||||||
} while (!(tileElement++)->IsLastForTile());
|
} while (!(tileElement++)->IsLastForTile());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool footpath_is_blocked_by_vehicle(const TileCoordsXYZ& position)
|
||||||
|
{
|
||||||
|
auto pathElement = map_get_path_element_at(position.x, position.y, position.z);
|
||||||
|
return pathElement != nullptr && (pathElement->flags & TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* rct2: 0x006A7642
|
* rct2: 0x006A7642
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ void footpath_update_queue_chains();
|
|||||||
bool fence_in_the_way(sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 direction);
|
bool fence_in_the_way(sint32 x, sint32 y, sint32 z0, sint32 z1, sint32 direction);
|
||||||
void footpath_chain_ride_queue(sint32 rideIndex, sint32 entranceIndex, sint32 x, sint32 y, rct_tile_element * tileElement, sint32 direction);
|
void footpath_chain_ride_queue(sint32 rideIndex, sint32 entranceIndex, sint32 x, sint32 y, rct_tile_element * tileElement, sint32 direction);
|
||||||
void footpath_update_path_wide_flags(sint32 x, sint32 y);
|
void footpath_update_path_wide_flags(sint32 x, sint32 y);
|
||||||
|
bool footpath_is_blocked_by_vehicle(const TileCoordsXYZ& position);
|
||||||
|
|
||||||
sint32 footpath_is_connected_to_map_edge(sint32 x, sint32 y, sint32 z, sint32 direction, sint32 flags);
|
sint32 footpath_is_connected_to_map_edge(sint32 x, sint32 y, sint32 z, sint32 direction, sint32 flags);
|
||||||
bool footpath_element_is_sloped(const rct_tile_element * tileElement);
|
bool footpath_element_is_sloped(const rct_tile_element * tileElement);
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ struct TileCoordsXYZ
|
|||||||
{
|
{
|
||||||
TileCoordsXYZ() = default;
|
TileCoordsXYZ() = default;
|
||||||
TileCoordsXYZ(sint32 x_, sint32 y_, sint32 z_) : x(x_), y(y_), z(z_) {}
|
TileCoordsXYZ(sint32 x_, sint32 y_, sint32 z_) : x(x_), y(y_), z(z_) {}
|
||||||
|
explicit TileCoordsXYZ(CoordsXY c, sint32 z_) : x(c.x / 32), y(c.y / 32), z(z_) {}
|
||||||
explicit TileCoordsXYZ(CoordsXYZ c) : x(c.x / 32), y(c.y / 32), z(c.z / 8) {}
|
explicit TileCoordsXYZ(CoordsXYZ c) : x(c.x / 32), y(c.y / 32), z(c.z / 8) {}
|
||||||
TileCoordsXYZ& operator+=(const TileCoordsXY rhs)
|
TileCoordsXYZ& operator+=(const TileCoordsXY rhs)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user