1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Refactor ride->entrances and ride->exits

This commit is contained in:
Michael Steenbeek
2018-03-07 19:10:50 +01:00
committed by GitHub
parent ab54d6c370
commit 1fa2fa8f80
25 changed files with 453 additions and 331 deletions

View File

@@ -36,6 +36,7 @@
#include "TrackData.h"
#include "TrackDesign.h"
#include "TrackDesignRepository.h"
#include "Station.h"
#define TRACK_MAX_SAVED_TILE_ELEMENTS 1500
@@ -860,10 +861,10 @@ static bool track_design_save_to_td6_for_maze(uint8 rideIndex, rct_track_td6 *td
x = 0;
}
Ride *ride = get_ride(rideIndex);
LocationXY8 location = ride->entrances[0];
TileCoordsXYZD location = ride_get_entrance_location(rideIndex, 0);
if (location.xy == RCT_XY8_UNDEFINED) {
if (location.isNull())
{
gGameCommandErrorText = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY;
SafeFree(td6->maze_elements);
return false;
@@ -888,11 +889,12 @@ static bool track_design_save_to_td6_for_maze(uint8 rideIndex, rct_track_td6 *td
maze++;
numMazeElements++;
location = ride->exits[0];
if (location.xy == RCT_XY8_UNDEFINED) {
location = ride_get_entrance_location(rideIndex, 0);
if (location.isNull())
{
gGameCommandErrorText = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY;
SafeFree(td6->maze_elements);
return 0;
return false;
}
x = location.x * 32;
@@ -1059,14 +1061,14 @@ static bool track_design_save_to_td6_for_tracked_ride(uint8 rideIndex, rct_track
for (sint32 station_index = 0; station_index < RCT12_MAX_STATIONS_PER_RIDE; station_index++) {
z = ride->station_heights[station_index];
LocationXY8 location;
TileCoordsXYZD location;
if (i == 0) {
location = ride->entrances[station_index];
location = ride_get_entrance_location(rideIndex, station_index);
} else {
location = ride->exits[station_index];
location = ride_get_exit_location(rideIndex, station_index);
}
if (location.xy == RCT_XY8_UNDEFINED) {
if (location.isNull()) {
continue;
}