Create TrackDesignMazElement struct

Closes #10053
This commit is contained in:
Tulio Leao 2019-10-07 21:39:18 -03:00
parent 6be7c42a3d
commit 7193ba1bb7
2 changed files with 33 additions and 4 deletions

View File

@ -379,7 +379,7 @@ rct_string_id TrackDesign::CreateTrackDesignMaze(const Ride& ride)
if (tileElement->AsTrack()->GetRideIndex() != ride.id)
continue;
rct_td46_maze_element maze{};
TrackDesignMazeElement maze{};
maze.maze_entry = tileElement->AsTrack()->GetMazeEntry();
maze.x = (x - startLoc.x) / 32;
@ -418,7 +418,7 @@ rct_string_id TrackDesign::CreateTrackDesignMaze(const Ride& ride)
// Add something that stops this from walking off the end
uint8_t entranceDirection = tileElement->GetDirection();
rct_td46_maze_element mazeEntrance{};
TrackDesignMazeElement mazeEntrance{};
mazeEntrance.direction = entranceDirection;
mazeEntrance.type = 8;
mazeEntrance.x = (int8_t)((entranceLoc.x - startLoc.x) / 32);
@ -445,7 +445,7 @@ rct_string_id TrackDesign::CreateTrackDesignMaze(const Ride& ride)
// Add something that stops this from walking off the end
uint8_t exit_direction = tileElement->GetDirection();
rct_td46_maze_element mazeExit{};
TrackDesignMazeElement mazeExit{};
mazeExit.direction = exit_direction;
mazeExit.type = 0x80;
mazeExit.x = (int8_t)((exitLoc.x - startLoc.x) / 32);

View File

@ -53,6 +53,35 @@ struct TrackDesignTrackElement
uint8_t flags; // 0x01
};
/* Maze Element entry size: 0x04 */
struct TrackDesignMazeElement
{
union
{
uint32_t all;
struct
{
int8_t x;
int8_t y;
union
{
uint16_t maze_entry;
struct
{
uint8_t direction;
uint8_t type;
};
};
};
};
TrackDesignMazeElement() = default;
TrackDesignMazeElement(const rct_td46_maze_element& formerMazeElement)
: all(formerMazeElement.all)
{
}
};
struct TrackDesign
{
uint8_t type;
@ -96,7 +125,7 @@ struct TrackDesign
uint8_t lift_hill_speed;
uint8_t num_circuits;
std::vector<rct_td46_maze_element> maze_elements;
std::vector<TrackDesignMazeElement> maze_elements;
std::vector<TrackDesignTrackElement> track_elements;
std::vector<TrackDesignEntranceElement> entrance_elements;
std::vector<TrackDesignSceneryElement> scenery_elements;