Use CoordsXYE on maze_entrance_hedge_replacement()

This commit is contained in:
Tulio Leao 2020-01-13 21:44:05 -03:00
parent 893086440c
commit a3ecefcf89
4 changed files with 11 additions and 11 deletions

View file

@ -171,7 +171,7 @@ public:
res->Position.z = tile_element_height(res->Position);
footpath_queue_chain_reset();
maze_entrance_hedge_replacement(_loc.x, _loc.y, tileElement);
maze_entrance_hedge_replacement({ _loc, tileElement });
footpath_remove_edges_at(_loc, tileElement);
tile_element_remove(tileElement);

View file

@ -7091,7 +7091,7 @@ void sub_6CB945(Ride* ride)
if (shouldRemove)
{
footpath_queue_chain_reset();
maze_entrance_hedge_replacement(location.x, location.y, tileElement);
maze_entrance_hedge_replacement({ location, tileElement });
footpath_remove_edges_at(location, tileElement);
footpath_update_queue_chains();
map_invalidate_tile_full(location);

View file

@ -128,15 +128,14 @@ money32 ride_entrance_exit_place_ghost(
* Replaces the outer hedge walls for an entrance placement removal.
* rct2: 0x00666D6F
*/
void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElement)
void maze_entrance_hedge_replacement(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
@ -157,7 +156,7 @@ void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElem
// Add the bottom outer wall
tileElement->AsTrack()->MazeEntryAdd(1 << ((mazeSection + 12) & 0x0F));
map_invalidate_tile({ x, y, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
map_invalidate_tile({ hedgePos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
return;
} while (!(tileElement++)->IsLastForTile());
}

View file

@ -12,6 +12,7 @@
#include "../common.h"
#include "Location.hpp"
#include "Map.h"
#include <vector>
@ -44,7 +45,7 @@ void park_entrance_remove_ghost();
money32 park_entrance_place_ghost(CoordsXYZD entranceLoc);
void reset_park_entrance();
void maze_entrance_hedge_replacement(int32_t x, int32_t y, TileElement* tileElement);
void maze_entrance_hedge_replacement(const CoordsXYE& entrance);
void maze_entrance_hedge_removal(int32_t x, int32_t y, TileElement* tileElement);
void fix_park_entrance_locations();