diff --git a/src/openrct2/rct1/T4Importer.cpp b/src/openrct2/rct1/T4Importer.cpp index 9e19b0dd71..eafec247ee 100644 --- a/src/openrct2/rct1/T4Importer.cpp +++ b/src/openrct2/rct1/T4Importer.cpp @@ -253,13 +253,18 @@ private: if (td->type == RIDE_TYPE_MAZE) { - rct_td46_maze_element mazeElement{}; - mazeElement.all = !0; - while (mazeElement.all != 0) + rct_td46_maze_element t4MazeElement{}; + t4MazeElement.all = !0; + while (t4MazeElement.all != 0) { - _stream.Read(&mazeElement, sizeof(rct_td46_maze_element)); - if (mazeElement.all != 0) + _stream.Read(&t4MazeElement, sizeof(rct_td46_maze_element)); + if (t4MazeElement.all != 0) { + TrackDesignMazeElement mazeElement{}; + mazeElement.x = t4MazeElement.x; + mazeElement.y = t4MazeElement.y; + mazeElement.direction = t4MazeElement.direction; + mazeElement.type = t4MazeElement.type; td->maze_elements.push_back(mazeElement); } } diff --git a/src/openrct2/rct2/T6Importer.cpp b/src/openrct2/rct2/T6Importer.cpp index e75962cf3a..1cf5767da6 100644 --- a/src/openrct2/rct2/T6Importer.cpp +++ b/src/openrct2/rct2/T6Importer.cpp @@ -138,13 +138,18 @@ public: if (td->type == RIDE_TYPE_MAZE) { - rct_td46_maze_element mazeElement{}; - mazeElement.all = !0; - while (mazeElement.all != 0) + rct_td46_maze_element t4MazeElement{}; + t4MazeElement.all = !0; + while (t4MazeElement.all != 0) { - _stream.Read(&mazeElement, sizeof(rct_td46_maze_element)); - if (mazeElement.all != 0) + _stream.Read(&t4MazeElement, sizeof(rct_td46_maze_element)); + if (t4MazeElement.all != 0) { + TrackDesignMazeElement mazeElement{}; + mazeElement.x = t4MazeElement.x; + mazeElement.y = t4MazeElement.y; + mazeElement.direction = t4MazeElement.direction; + mazeElement.type = t4MazeElement.type; td->maze_elements.push_back(mazeElement); } } diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 6ab5bdedb0..c0a64337e0 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -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); diff --git a/src/openrct2/ride/TrackDesign.h b/src/openrct2/ride/TrackDesign.h index 0a24968ba3..87f94be42c 100644 --- a/src/openrct2/ride/TrackDesign.h +++ b/src/openrct2/ride/TrackDesign.h @@ -53,6 +53,29 @@ 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; + }; + }; + }; + }; +}; + struct TrackDesign { uint8_t type; @@ -96,7 +119,7 @@ struct TrackDesign uint8_t lift_hill_speed; uint8_t num_circuits; - std::vector maze_elements; + std::vector maze_elements; std::vector track_elements; std::vector entrance_elements; std::vector scenery_elements;