mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use CoordsXY on Map::map_surface_is_blocked() (#10369)
* Use CoordsXY on Map::map_surface_is_blocked() * Update src/openrct2/peep/GuestPathfinding.cpp * Use map_is_location_valid() instead of hardcoded number
This commit is contained in:
parent
1ace96ccc4
commit
801e6e085d
|
@ -149,7 +149,7 @@ static int32_t guest_surface_path_finding(Peep* peep)
|
|||
|
||||
if (!fence_in_the_way(x, y, z, z + 4, backwardsDirection))
|
||||
{
|
||||
if (!map_surface_is_blocked(x, y))
|
||||
if (!map_surface_is_blocked({ x, y }))
|
||||
{
|
||||
return peep_move_one_tile(randDirection, peep);
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ static int32_t guest_surface_path_finding(Peep* peep)
|
|||
|
||||
if (!fence_in_the_way(x, y, z, z + 4, backwardsDirection))
|
||||
{
|
||||
if (!map_surface_is_blocked(x, y))
|
||||
if (!map_surface_is_blocked({ x, y }))
|
||||
{
|
||||
return peep_move_one_tile(randDirection, peep);
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ static int32_t guest_surface_path_finding(Peep* peep)
|
|||
|
||||
if (!fence_in_the_way(x, y, z, z + 4, backwardsDirection))
|
||||
{
|
||||
if (!map_surface_is_blocked(x, y))
|
||||
if (!map_surface_is_blocked({ x, y }))
|
||||
{
|
||||
return peep_move_one_tile(randDirection, peep);
|
||||
}
|
||||
|
|
|
@ -576,10 +576,10 @@ static int32_t staff_handyman_direction_rand_surface(Peep* peep, uint8_t validDi
|
|||
if (!(validDirections & (1 << direction)))
|
||||
continue;
|
||||
|
||||
LocationXY16 chosenTile = { static_cast<int16_t>(peep->next_x + CoordsDirectionDelta[direction].x),
|
||||
static_cast<int16_t>(peep->next_y + CoordsDirectionDelta[direction].y) };
|
||||
CoordsXY chosenTile = { peep->next_x + CoordsDirectionDelta[direction].x,
|
||||
peep->next_y + CoordsDirectionDelta[direction].y };
|
||||
|
||||
if (map_surface_is_blocked(chosenTile.x, chosenTile.y))
|
||||
if (map_surface_is_blocked(chosenTile))
|
||||
continue;
|
||||
|
||||
break;
|
||||
|
@ -714,10 +714,10 @@ static uint8_t staff_direction_surface(Peep* peep, uint8_t initialDirection)
|
|||
if (fence_in_the_way(peep->next_x, peep->next_y, peep->next_z, peep->next_z + 4, direction_reverse(direction)))
|
||||
continue;
|
||||
|
||||
LocationXY16 chosenTile = { static_cast<int16_t>(peep->next_x + CoordsDirectionDelta[direction].x),
|
||||
static_cast<int16_t>(peep->next_y + CoordsDirectionDelta[direction].y) };
|
||||
CoordsXY chosenTile = { peep->next_x + CoordsDirectionDelta[direction].x,
|
||||
peep->next_y + CoordsDirectionDelta[direction].y };
|
||||
|
||||
if (!map_surface_is_blocked(chosenTile.x, chosenTile.y))
|
||||
if (!map_surface_is_blocked(chosenTile))
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
|
|
|
@ -2054,12 +2054,12 @@ int32_t map_get_tile_quadrant(int32_t mapX, int32_t mapY)
|
|||
*
|
||||
* rct2: 0x00693BFF
|
||||
*/
|
||||
bool map_surface_is_blocked(int16_t x, int16_t y)
|
||||
bool map_surface_is_blocked(CoordsXY mapCoords)
|
||||
{
|
||||
if (x >= 8192 || y >= 8192)
|
||||
if (!map_is_location_valid(mapCoords))
|
||||
return true;
|
||||
|
||||
auto surfaceElement = map_get_surface_element_at({ x, y });
|
||||
auto surfaceElement = map_get_surface_element_at(mapCoords);
|
||||
|
||||
if (surfaceElement == nullptr)
|
||||
{
|
||||
|
|
|
@ -165,7 +165,7 @@ bool map_can_build_at(const CoordsXYZ& loc);
|
|||
bool map_is_location_owned(const CoordsXYZ& loc);
|
||||
bool map_is_location_in_park(const CoordsXY& coords);
|
||||
bool map_is_location_owned_or_has_rights(const CoordsXY& loc);
|
||||
bool map_surface_is_blocked(int16_t x, int16_t y);
|
||||
bool map_surface_is_blocked(CoordsXY mapCoords);
|
||||
void tile_element_remove(TileElement* tileElement);
|
||||
void map_remove_all_rides();
|
||||
void map_invalidate_map_selection_tiles();
|
||||
|
|
Loading…
Reference in New Issue