Use CoordsXYE on maze_entrance_hedge_removal()

This commit is contained in:
Tulio Leao 2020-01-13 21:48:12 -03:00
parent a3ecefcf89
commit c8097eab3a
4 changed files with 12 additions and 15 deletions

View File

@ -221,7 +221,7 @@ public:
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST))
{
maze_entrance_hedge_removal(_loc.x, _loc.y, tileElement);
maze_entrance_hedge_removal({ _loc, tileElement });
}
footpath_connect_edges(_loc, tileElement, GetFlags());

View File

@ -4271,9 +4271,7 @@ static void ride_set_maze_entrance_exit_points(Ride* ride)
// Enumerate entrance and exit positions
for (position = positions; !(*position).isNull(); position++)
{
int32_t x = (*position).x << 5;
int32_t y = (*position).y << 5;
int32_t z = (*position).z;
auto entranceExitMapPos = position->ToCoordsXYZ();
TileElement* tileElement = map_get_first_element_at(position->ToCoordsXY());
do
@ -4287,10 +4285,10 @@ static void ride_set_maze_entrance_exit_points(Ride* ride)
{
continue;
}
if (tileElement->base_height != z)
if (tileElement->GetBaseZ() != entranceExitMapPos.z)
continue;
maze_entrance_hedge_removal(x, y, tileElement);
maze_entrance_hedge_removal({ entranceExitMapPos, tileElement });
} while (!(tileElement++)->IsLastForTile());
}
}

View File

@ -165,15 +165,14 @@ void maze_entrance_hedge_replacement(const CoordsXYE& entrance)
* Removes the hedge walls for an entrance placement.
* rct2: 0x00666CBE
*/
void maze_entrance_hedge_removal(int32_t x, int32_t y, TileElement* tileElement)
void maze_entrance_hedge_removal(const CoordsXYE& entrance)
{
int32_t direction = tileElement->GetDirection();
x += CoordsDirectionDelta[direction].x;
y += CoordsDirectionDelta[direction].y;
int32_t z = tileElement->GetBaseZ();
ride_id_t rideIndex = tileElement->AsEntrance()->GetRideIndex();
int32_t direction = entrance.element->GetDirection();
auto hedgePos = entrance + CoordsDirectionDelta[direction];
int32_t z = entrance.element->GetBaseZ();
ride_id_t rideIndex = entrance.element->AsEntrance()->GetRideIndex();
tileElement = map_get_first_element_at({ x, y });
auto tileElement = map_get_first_element_at(hedgePos);
if (tileElement == nullptr)
return;
do
@ -200,7 +199,7 @@ void maze_entrance_hedge_removal(int32_t x, int32_t y, TileElement* tileElement)
// Remove the bottom hedge section
tileElement->AsTrack()->MazeEntrySubtract(1 << ((mazeSection + 15) & 0x0F));
map_invalidate_tile({ x, y, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
map_invalidate_tile({ hedgePos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
return;
} while (!(tileElement++)->IsLastForTile());
}

View File

@ -46,7 +46,7 @@ money32 park_entrance_place_ghost(CoordsXYZD entranceLoc);
void reset_park_entrance();
void maze_entrance_hedge_replacement(const CoordsXYE& entrance);
void maze_entrance_hedge_removal(int32_t x, int32_t y, TileElement* tileElement);
void maze_entrance_hedge_removal(const CoordsXYE& entrance);
void fix_park_entrance_locations();