mirror of https://github.com/OpenRCT2/OpenRCT2.git
Make map entrance/exit fetching functions use only CoordsXY objects
This commit is contained in:
parent
72d19f779b
commit
c71c4284d0
|
@ -2971,9 +2971,10 @@ private:
|
|||
ride->stations[0].Exit = exitCoords;
|
||||
|
||||
auto entranceElement = map_get_ride_exit_element_at(
|
||||
{ entranceCoords.x, entranceCoords.y, entranceCoords.z }, false);
|
||||
{ entranceCoords.x << 5, entranceCoords.y << 5, entranceCoords.z << 3 }, false);
|
||||
entranceElement->SetEntranceType(ENTRANCE_TYPE_RIDE_ENTRANCE);
|
||||
auto exitElement = map_get_ride_entrance_element_at({ exitCoords.x, exitCoords.y, exitCoords.z }, false);
|
||||
auto exitElement = map_get_ride_entrance_element_at(
|
||||
{ exitCoords.x << 5, exitCoords.y << 5, exitCoords.z << 3 }, false);
|
||||
exitElement->SetEntranceType(ENTRANCE_TYPE_RIDE_EXIT);
|
||||
|
||||
// Trigger footpath update
|
||||
|
|
|
@ -7678,7 +7678,7 @@ void determine_ride_entrance_and_exit_locations()
|
|||
if (!entranceLoc.isNull())
|
||||
{
|
||||
const EntranceElement* entranceElement = map_get_ride_entrance_element_at(
|
||||
{ entranceLoc.x, entranceLoc.y, entranceLoc.z }, false);
|
||||
{ entranceLoc.x << 5, entranceLoc.y << 5, entranceLoc.z << 3 }, false);
|
||||
|
||||
if (entranceElement == nullptr || entranceElement->GetRideIndex() != ride.id
|
||||
|| entranceElement->GetStationIndex() != stationIndex)
|
||||
|
@ -7694,7 +7694,7 @@ void determine_ride_entrance_and_exit_locations()
|
|||
if (!exitLoc.isNull())
|
||||
{
|
||||
const EntranceElement* entranceElement = map_get_ride_exit_element_at(
|
||||
{ exitLoc.x, exitLoc.y, exitLoc.z }, false);
|
||||
{ exitLoc.x << 5, exitLoc.y << 5, exitLoc.z << 3 }, false);
|
||||
|
||||
if (entranceElement == nullptr || entranceElement->GetRideIndex() != ride.id
|
||||
|| entranceElement->GetStationIndex() != stationIndex)
|
||||
|
|
|
@ -1791,8 +1791,9 @@ EntranceElement* map_get_park_entrance_element_at(const CoordsXYZ& entranceCoord
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
EntranceElement* map_get_ride_entrance_element_at(const TileCoordsXYZ& entranceTileCoords, bool ghost)
|
||||
EntranceElement* map_get_ride_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost)
|
||||
{
|
||||
auto entranceTileCoords = TileCoordsXYZ{ entranceCoords };
|
||||
TileElement* tileElement = map_get_first_element_at(entranceTileCoords.x, entranceTileCoords.y);
|
||||
if (tileElement != nullptr)
|
||||
{
|
||||
|
@ -1816,8 +1817,9 @@ EntranceElement* map_get_ride_entrance_element_at(const TileCoordsXYZ& entranceT
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
EntranceElement* map_get_ride_exit_element_at(const TileCoordsXYZ& exitTileCoords, bool ghost)
|
||||
EntranceElement* map_get_ride_exit_element_at(const CoordsXYZ& exitCoords, bool ghost)
|
||||
{
|
||||
auto exitTileCoords = TileCoordsXYZ{ exitCoords };
|
||||
TileElement* tileElement = map_get_first_element_at(exitTileCoords.x, exitTileCoords.y);
|
||||
if (tileElement != nullptr)
|
||||
{
|
||||
|
|
|
@ -149,8 +149,8 @@ PathElement* map_get_path_element_at(const TileCoordsXYZ& loc);
|
|||
WallElement* map_get_wall_element_at(int32_t x, int32_t y, int32_t z, int32_t direction);
|
||||
SmallSceneryElement* map_get_small_scenery_element_at(int32_t x, int32_t y, int32_t z, int32_t type, uint8_t quadrant);
|
||||
EntranceElement* map_get_park_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost);
|
||||
EntranceElement* map_get_ride_entrance_element_at(const TileCoordsXYZ& entranceTileCoords, bool ghost);
|
||||
EntranceElement* map_get_ride_exit_element_at(const TileCoordsXYZ& exitTileCoords, bool ghost);
|
||||
EntranceElement* map_get_ride_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost);
|
||||
EntranceElement* map_get_ride_exit_element_at(const CoordsXYZ& exitCoords, bool ghost);
|
||||
int16_t tile_element_height(const CoordsXY& loc);
|
||||
int16_t tile_element_water_height(const CoordsXY& loc);
|
||||
uint8_t map_get_highest_land_height(const MapRange& range);
|
||||
|
|
|
@ -94,7 +94,7 @@ TEST_F(TileElementWantsFootpathConnection, Stall)
|
|||
TEST_F(TileElementWantsFootpathConnection, RideEntrance)
|
||||
{
|
||||
// Ride entrances and exits want a connection in one direction
|
||||
const EntranceElement* const entranceElement = map_get_ride_entrance_element_at({ 18, 8, 14 }, false);
|
||||
const EntranceElement* const entranceElement = map_get_ride_entrance_element_at({ 18 << 5, 8 << 5, 14 << 3 }, false);
|
||||
ASSERT_NE(entranceElement, nullptr);
|
||||
EXPECT_TRUE(tile_element_wants_path_connection_towards({ 18, 8, 14, 0 }, nullptr));
|
||||
EXPECT_FALSE(tile_element_wants_path_connection_towards({ 18, 8, 14, 1 }, nullptr));
|
||||
|
@ -106,7 +106,7 @@ TEST_F(TileElementWantsFootpathConnection, RideEntrance)
|
|||
TEST_F(TileElementWantsFootpathConnection, RideExit)
|
||||
{
|
||||
// The exit has been rotated; it wants a path connection in direction 1, but not 0 like the entrance
|
||||
const EntranceElement* const exitElement = map_get_ride_exit_element_at({ 18, 10, 14 }, false);
|
||||
const EntranceElement* const exitElement = map_get_ride_exit_element_at({ 18 << 5, 10 << 5, 14 << 3 }, false);
|
||||
ASSERT_NE(exitElement, nullptr);
|
||||
EXPECT_FALSE(tile_element_wants_path_connection_towards({ 18, 10, 14, 0 }, nullptr));
|
||||
EXPECT_TRUE(tile_element_wants_path_connection_towards({ 18, 10, 14, 1 }, nullptr));
|
||||
|
|
Loading…
Reference in New Issue