Fix #10631: Assertion fails when modifying copied station pieces

This commit is contained in:
Gymnasiast 2020-03-21 15:18:55 +01:00
parent 2f7a26e8da
commit 0f8fec1413
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
2 changed files with 26 additions and 15 deletions

View File

@ -29,6 +29,7 @@
- Fix: [#10543] Secondary shop item prices are not imported correctly from RCT1 saves.
- Fix: [#10547] RCT1 parks have too many rides available.
- Fix: [#10587] Update last action coordinates on correct player.
- Fix: [#10631] Game bugs out and crashes if you get too many stations via copying stations with the tile inspector.
- Fix: [#10662] Duck cheat tooltips look odd and do not explain anything.
- Fix: [#10694] The lift hill speed of the flying roller coaster cannot be changed (original bug).
- Fix: [#10705] Apply multithreaded rendering to all viewports.

View File

@ -743,13 +743,18 @@ bool track_add_station_element(CoordsXYZD loc, ride_id_t rideIndex, int32_t flag
if (stationLoc1 == loc)
{
auto stationIndex = ride_get_first_empty_station_start(ride);
assert(stationIndex != STATION_INDEX_NULL);
ride->stations[stationIndex].Start = loc;
ride->stations[stationIndex].Height = loc.z / COORDS_Z_STEP;
ride->stations[stationIndex].Depart = 1;
ride->stations[stationIndex].Length = stationLength;
ride->num_stations++;
if (stationIndex == STATION_INDEX_NULL)
{
log_verbose("No empty station starts, not updating metadata! This can happen with hacked rides.");
}
else
{
ride->stations[stationIndex].Start = loc;
ride->stations[stationIndex].Height = loc.z / COORDS_Z_STEP;
ride->stations[stationIndex].Depart = 1;
ride->stations[stationIndex].Length = stationLength;
ride->num_stations++;
}
targetTrackType = TRACK_ELEM_END_STATION;
}
@ -887,14 +892,19 @@ bool track_remove_station_element(int32_t x, int32_t y, int32_t z, Direction dir
{
loc_6C4BF5:;
auto stationIndex = ride_get_first_empty_station_start(ride);
assert(stationIndex != STATION_INDEX_NULL);
ride->stations[stationIndex].Start.x = x;
ride->stations[stationIndex].Start.y = y;
ride->stations[stationIndex].Height = z;
ride->stations[stationIndex].Depart = 1;
ride->stations[stationIndex].Length = stationLength != 0 ? stationLength : byte_F441D1;
ride->num_stations++;
if (stationIndex == STATION_INDEX_NULL)
{
log_verbose("No empty station starts, not updating metadata! This can happen with hacked rides.");
}
else
{
ride->stations[stationIndex].Start.x = x;
ride->stations[stationIndex].Start.y = y;
ride->stations[stationIndex].Height = z;
ride->stations[stationIndex].Depart = 1;
ride->stations[stationIndex].Length = stationLength != 0 ? stationLength : byte_F441D1;
ride->num_stations++;
}
stationLength = 0;
targetTrackType = TRACK_ELEM_END_STATION;