Use CoordsXYZD on footpath_is_connected_to_map_edge()

This commit is contained in:
Tulio Leao 2020-01-04 09:09:07 -03:00
parent 301e0cfeb1
commit 6189d13b2c
3 changed files with 7 additions and 8 deletions

View File

@ -500,12 +500,9 @@ namespace Editor
for (const auto& parkEntrance : gParkEntrances)
{
int32_t x = parkEntrance.x;
int32_t y = parkEntrance.y;
int32_t z = parkEntrance.z / 8;
int32_t direction = direction_reverse(parkEntrance.direction);
switch (footpath_is_connected_to_map_edge(x, y, z, direction, 0))
switch (footpath_is_connected_to_map_edge(parkEntrance, direction, 0))
{
case FOOTPATH_SEARCH_NOT_FOUND:
gGameCommandErrorText = STR_PARK_ENTRANCE_WRONG_DIRECTION_OR_NO_PATH;
@ -516,7 +513,7 @@ namespace Editor
return false;
case FOOTPATH_SEARCH_SUCCESS:
// Run the search again and unown the path
footpath_is_connected_to_map_edge(x, y, z, direction, (1 << 5));
footpath_is_connected_to_map_edge(parkEntrance, direction, (1 << 5));
break;
}
}

View File

@ -1418,10 +1418,12 @@ searchFromFootpath:
}
}
int32_t footpath_is_connected_to_map_edge(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t flags)
// TODO: Use GAME_COMMAND_FLAGS
int32_t footpath_is_connected_to_map_edge(const CoordsXYZ& footpathPos, int32_t direction, int32_t flags)
{
flags |= (1 << 0);
return footpath_is_connected_to_map_edge_recurse(x, y, z, direction, flags, 0, 0, 16);
return footpath_is_connected_to_map_edge_recurse(
footpathPos.x, footpathPos.y, footpathPos.z / COORDS_Z_STEP, direction, flags, 0, 0, 16);
}
bool PathElement::IsSloped() const

View File

@ -196,7 +196,7 @@ void footpath_chain_ride_queue(
void footpath_update_path_wide_flags(int32_t x, int32_t y);
bool footpath_is_blocked_by_vehicle(const TileCoordsXYZ& position);
int32_t footpath_is_connected_to_map_edge(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t flags);
int32_t footpath_is_connected_to_map_edge(const CoordsXYZ& footpathPos, int32_t direction, int32_t flags);
void footpath_remove_edges_at(const CoordsXY& footpathPos, TileElement* tileElement);
int32_t entrance_get_directions(const TileElement* tileElement);