mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add overload for map_get_first_element_at to accept TileCoordsXY
This commit is contained in:
parent
75c2dbcf74
commit
a3b0c9ac81
|
@ -283,15 +283,26 @@ void tile_element_iterator_restart_for_tile(tile_element_iterator* it)
|
||||||
it->element = nullptr;
|
it->element = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileElement* map_get_first_element_at(const CoordsXY& elementPos)
|
static bool IsTileLocationValid(const TileCoordsXY& coords)
|
||||||
{
|
{
|
||||||
if (!map_is_location_valid(elementPos))
|
const bool is_x_valid = coords.x < MAXIMUM_MAP_SIZE_TECHNICAL && coords.x >= 0;
|
||||||
|
const bool is_y_valid = coords.y < MAXIMUM_MAP_SIZE_TECHNICAL && coords.y >= 0;
|
||||||
|
return is_x_valid && is_y_valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
TileElement* map_get_first_element_at(const TileCoordsXY& tilePos)
|
||||||
|
{
|
||||||
|
if (!IsTileLocationValid(tilePos))
|
||||||
{
|
{
|
||||||
log_verbose("Trying to access element outside of range");
|
log_verbose("Trying to access element outside of range");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto tileElementPos = TileCoordsXY{ elementPos };
|
return _tileIndex.GetFirstElementAt(tilePos);
|
||||||
return _tileIndex.GetFirstElementAt(tileElementPos);
|
}
|
||||||
|
|
||||||
|
TileElement* map_get_first_element_at(const CoordsXY& elementPos)
|
||||||
|
{
|
||||||
|
return map_get_first_element_at(TileCoordsXY{ elementPos });
|
||||||
}
|
}
|
||||||
|
|
||||||
TileElement* map_get_nth_element_at(const CoordsXY& coords, int32_t n)
|
TileElement* map_get_nth_element_at(const CoordsXY& coords, int32_t n)
|
||||||
|
|
|
@ -191,7 +191,8 @@ void map_init(int32_t size);
|
||||||
|
|
||||||
void map_count_remaining_land_rights();
|
void map_count_remaining_land_rights();
|
||||||
void map_strip_ghost_flag_from_elements();
|
void map_strip_ghost_flag_from_elements();
|
||||||
TileElement* map_get_first_element_at(const CoordsXY& elementPos);
|
TileElement* map_get_first_element_at(const CoordsXY& tilePos);
|
||||||
|
TileElement* map_get_first_element_at(const TileCoordsXY& tilePos);
|
||||||
TileElement* map_get_nth_element_at(const CoordsXY& coords, int32_t n);
|
TileElement* map_get_nth_element_at(const CoordsXY& coords, int32_t n);
|
||||||
void map_set_tile_element(const TileCoordsXY& tilePos, TileElement* elements);
|
void map_set_tile_element(const TileCoordsXY& tilePos, TileElement* elements);
|
||||||
int32_t map_height_from_slope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped);
|
int32_t map_height_from_slope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped);
|
||||||
|
|
Loading…
Reference in New Issue