1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 14:02:59 +01:00

Refactor map_get_highest_z to use CoordsXY

This commit is contained in:
duncanspumpkin
2019-08-18 11:21:56 +01:00
parent a3ad551d10
commit b77f15c4b7
3 changed files with 7 additions and 7 deletions

View File

@@ -3489,7 +3489,7 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
z = _trackPlaceZ;
if (z == 0)
z = map_get_highest_z(x >> 5, y >> 5);
z = map_get_highest_z({ x, y });
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW;
@@ -3531,7 +3531,7 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
{
if (selectedTile.x < (256 * 32) && selectedTile.y < (256 * 32))
{
z = map_get_highest_z(selectedTile.x / 32, selectedTile.y / 32);
z = map_get_highest_z(selectedTile);
if (z > highestZ)
highestZ = z;
}
@@ -3755,7 +3755,7 @@ void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY)
if (selectedTile.x >= (256 * 32) || selectedTile.y >= (256 * 32))
continue;
z = map_get_highest_z(selectedTile.x / 32, selectedTile.y / 32);
z = map_get_highest_z(selectedTile);
if (z > highestZ)
highestZ = z;
}
@@ -3769,7 +3769,7 @@ void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY)
z = _trackPlaceZ;
if (z == 0)
z = map_get_highest_z(x >> 5, y >> 5);
z = map_get_highest_z({ x, y });
tool_cancel();

View File

@@ -1723,11 +1723,11 @@ static void clear_elements_at(const CoordsXY& loc)
clear_element_at(loc, &tileElement);
}
int32_t map_get_highest_z(int32_t tileX, int32_t tileY)
int32_t map_get_highest_z(const CoordsXY& loc)
{
uint32_t z;
auto surfaceElement = map_get_surface_element_at(tileX, tileY);
auto surfaceElement = map_get_surface_element_at(loc);
if (surfaceElement == nullptr)
return -1;

View File

@@ -200,7 +200,7 @@ void tile_element_iterator_restart_for_tile(tile_element_iterator* it);
void wall_remove_intersecting_walls(int32_t x, int32_t y, int32_t z0, int32_t z1, int32_t direction);
void map_update_tiles();
int32_t map_get_highest_z(int32_t tileX, int32_t tileY);
int32_t map_get_highest_z(const CoordsXY& loc);
bool tile_element_wants_path_connection_towards(TileCoordsXYZD coords, const TileElement* const elementToBeRemoved);