1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-31 10:45:16 +01:00

Remove map_get_surface_element_at operating with TileCoordsXY

This commit is contained in:
Tulio Leao
2019-12-18 00:25:12 -03:00
parent 7c75db2b2d
commit 5c657bde9f
9 changed files with 43 additions and 40 deletions

View File

@@ -203,8 +203,9 @@ void map_set_tile_elements(int32_t x, int32_t y, TileElement* elements)
gTileElementTilePointers[x + y * MAXIMUM_MAP_SIZE_TECHNICAL] = elements;
}
SurfaceElement* map_get_surface_element_at(const TileCoordsXY& tileCoords)
SurfaceElement* map_get_surface_element_at(const CoordsXY& coords)
{
auto tileCoords = TileCoordsXY{ coords };
TileElement* tileElement = map_get_first_element_at(tileCoords.x, tileCoords.y);
if (tileElement == nullptr)
@@ -222,11 +223,6 @@ SurfaceElement* map_get_surface_element_at(const TileCoordsXY& tileCoords)
return tileElement->AsSurface();
}
SurfaceElement* map_get_surface_element_at(const CoordsXY& coords)
{
return map_get_surface_element_at(TileCoordsXY(coords));
}
PathElement* map_get_path_element_at(const TileCoordsXYZ& loc)
{
TileElement* tileElement = map_get_first_element_at(loc.x, loc.y);
@@ -327,7 +323,7 @@ void map_count_remaining_land_rights()
{
for (int32_t y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++)
{
auto* surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y });
auto* surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY());
// Surface elements are sometimes hacked out to save some space for other map elements
if (surfaceElement == nullptr)
{
@@ -1474,7 +1470,7 @@ void map_update_tiles()
interleaved_xy >>= 1;
}
auto* surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y });
auto* surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY());
if (surfaceElement != nullptr)
{
surfaceElement->UpdateGrassLength({ x * 32, y * 32 });
@@ -1617,8 +1613,8 @@ void map_extend_boundary_surface()
y = gMapSize - 2;
for (x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++)
{
existingTileElement = map_get_surface_element_at(TileCoordsXY{ x, y - 1 });
newTileElement = map_get_surface_element_at(TileCoordsXY{ x, y });
existingTileElement = map_get_surface_element_at(TileCoordsXY{ x, y - 1 }.ToCoordsXY());
newTileElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY());
if (existingTileElement && newTileElement)
{
@@ -1631,8 +1627,8 @@ void map_extend_boundary_surface()
x = gMapSize - 2;
for (y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++)
{
existingTileElement = map_get_surface_element_at(TileCoordsXY{ x - 1, y });
newTileElement = map_get_surface_element_at(TileCoordsXY{ x, y });
existingTileElement = map_get_surface_element_at(TileCoordsXY{ x - 1, y }.ToCoordsXY());
newTileElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY());
if (existingTileElement && newTileElement)
{
@@ -2398,7 +2394,7 @@ void FixLandOwnershipTilesWithOwnership(std::initializer_list<TileCoordsXY> tile
{
for (const TileCoordsXY* tile = tiles.begin(); tile != tiles.end(); ++tile)
{
auto surfaceElement = map_get_surface_element_at(*tile);
auto surfaceElement = map_get_surface_element_at(tile->ToCoordsXY());
if (surfaceElement != nullptr)
{
surfaceElement->SetOwnership(ownership);