1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Make Map::map_get_track_element_at_of_type_from_ride() use CoordsXYZ

This commit is contained in:
Tulio Leao
2019-12-23 09:26:08 -03:00
parent 21435a4d01
commit c718d2be42
3 changed files with 10 additions and 11 deletions

View File

@@ -125,8 +125,7 @@ public:
}
}
TileElement* tileElement = map_get_track_element_at_of_type_from_ride(
_loc.x, _loc.y, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
TileElement* tileElement = map_get_track_element_at_of_type_from_ride(_loc, TRACK_ELEM_MAZE, _rideIndex);
if (tileElement == nullptr)
{
if (_mode != GC_SET_MAZE_TRACK_BUILD)
@@ -207,7 +206,7 @@ public:
uint8_t baseHeight = _loc.z / 8;
uint8_t clearanceHeight = (_loc.z + 32) / 8;
auto tileElement = map_get_track_element_at_of_type_from_ride(_loc.x, _loc.y, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
auto tileElement = map_get_track_element_at_of_type_from_ride(_loc, TRACK_ELEM_MAZE, _rideIndex);
if (tileElement == nullptr)
{
money32 price = (((RideTrackCosts[ride->type].track_price * TrackPricing[TRACK_ELEM_MAZE]) >> 16));
@@ -265,7 +264,7 @@ public:
uint16_t previousElementY = floor2(_loc.y, 32) - CoordsDirectionDelta[_loc.direction].y;
TileElement* previousTileElement = map_get_track_element_at_of_type_from_ride(
previousElementX, previousElementY, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
{ previousElementX, previousElementY, _loc.z }, TRACK_ELEM_MAZE, _rideIndex);
if (previousTileElement != nullptr)
{
@@ -291,7 +290,7 @@ public:
uint16_t previousSegmentY = _loc.y - CoordsDirectionDelta[_loc.direction].y / 2;
tileElement = map_get_track_element_at_of_type_from_ride(
previousSegmentX, previousSegmentY, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
{ previousSegmentX, previousSegmentY, _loc.z }, TRACK_ELEM_MAZE, _rideIndex);
map_invalidate_tile_full(floor2(previousSegmentX, 32), floor2(previousSegmentY, 32));
if (tileElement == nullptr)
@@ -320,7 +319,7 @@ public:
uint16_t nextElementY = floor2(previousSegmentY, 32) + CoordsDirectionDelta[direction1].y;
TileElement* tmp_tileElement = map_get_track_element_at_of_type_from_ride(
nextElementX, nextElementY, baseHeight, TRACK_ELEM_MAZE, _rideIndex);
{ nextElementX, nextElementY, _loc.z }, TRACK_ELEM_MAZE, _rideIndex);
if (tmp_tileElement != nullptr)
{

View File

@@ -2259,16 +2259,17 @@ TrackElement* map_get_track_element_at_of_type_seq(CoordsXYZD location, int32_t
* @param y y units, not tiles.
* @param z Base height.
*/
TileElement* map_get_track_element_at_of_type_from_ride(int32_t x, int32_t y, int32_t z, int32_t trackType, ride_id_t rideIndex)
TileElement* map_get_track_element_at_of_type_from_ride(const CoordsXYZ& trackPos, int32_t trackType, ride_id_t rideIndex)
{
TileElement* tileElement = map_get_first_element_at({ x, y });
TileElement* tileElement = map_get_first_element_at(trackPos);
if (tileElement == nullptr)
return nullptr;
auto trackTilePos = TileCoordsXYZ{ trackPos };
do
{
if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
continue;
if (tileElement->base_height != z)
if (tileElement->base_height != trackTilePos.z)
continue;
if (tileElement->AsTrack()->GetRideIndex() != rideIndex)
continue;

View File

@@ -234,8 +234,7 @@ TileElement* map_get_track_element_at_of_type(const CoordsXYZ& trackPos, int32_t
TileElement* map_get_track_element_at_of_type_seq(const CoordsXYZ& trackPos, int32_t trackType, int32_t sequence);
TrackElement* map_get_track_element_at_of_type(CoordsXYZD location, int32_t trackType);
TrackElement* map_get_track_element_at_of_type_seq(CoordsXYZD location, int32_t trackType, int32_t sequence);
TileElement* map_get_track_element_at_of_type_from_ride(
int32_t x, int32_t y, int32_t z, int32_t trackType, ride_id_t rideIndex);
TileElement* map_get_track_element_at_of_type_from_ride(const CoordsXYZ& trackPos, int32_t trackType, ride_id_t rideIndex);
TileElement* map_get_track_element_at_from_ride(int32_t x, int32_t y, int32_t z, ride_id_t rideIndex);
TileElement* map_get_track_element_at_with_direction_from_ride(
int32_t x, int32_t y, int32_t z, int32_t direction, ride_id_t rideIndex);