From 9ca4e48c79f168e6a063d49c1ef92a8c69bc120b Mon Sep 17 00:00:00 2001 From: kyphii <8711258+kyphii@users.noreply.github.com> Date: Sat, 22 Apr 2023 13:41:26 -0400 Subject: [PATCH] Fix: #13397: Broken Stations with Simulate Mode --- distribution/changelog.txt | 1 + src/openrct2/actions/TrackPlaceAction.cpp | 6 +++--- src/openrct2/actions/TrackRemoveAction.cpp | 2 +- src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/ride/TrackDesign.cpp | 3 ++- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index ebe5967035..191eadf4ef 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -19,6 +19,7 @@ - Change: [OpenSFX#17] Update Hybrid RC lifthill loop. - Fix: [#12598] Number of holes is not set correctly when saving track designs. - Fix: [#13130] Android always defaulting to UK locale for language, currency and temperature. +- Fix: [#13397] Ride simulation causes strange station behaviour and makes the ride unusable in some cases - Fix: [#16791] Rotodrop top piece replicates when walls are placed around it and clearance checks are disabled (original bug). - Fix: [#18895] Responding mechanic blocked at level crossing. - Fix: [#19231] Crash due to null pointer to previously deleted banner in tile copy/paste functionality diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index fbfaf0e20f..f333d66724 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -622,9 +622,9 @@ GameActions::Result TrackPlaceAction::Execute() const } // If the placed tile is a station modify station properties. - // Don't do this if the ride is simulating and the tile is a ghost to prevent desyncs. - if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN - && !(ride->status == RideStatus::Simulating && GetFlags() & GAME_COMMAND_FLAG_GHOST)) + // Don't do this if the tile is a ghost to prevent desyncs + // However, ghost tiles from track designs need to modify station data to display properly + if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN && (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) || _fromTrackDesign)) { if (trackBlock->index == 0) { diff --git a/src/openrct2/actions/TrackRemoveAction.cpp b/src/openrct2/actions/TrackRemoveAction.cpp index 687dc9b065..546f96dba4 100644 --- a/src/openrct2/actions/TrackRemoveAction.cpp +++ b/src/openrct2/actions/TrackRemoveAction.cpp @@ -421,7 +421,7 @@ GameActions::Result TrackRemoveAction::Execute() const // If the removed tile is a station modify station properties. // Don't do this if the ride is simulating and the tile is a ghost to prevent desyncs. if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN - && !(ride->status == RideStatus::Simulating && tileElement->Flags & TILE_ELEMENT_FLAG_GHOST) + && (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) || (GetFlags() & GAME_COMMAND_FLAG_TRACK_DESIGN)) && (tileElement->AsTrack()->GetSequenceIndex() == 0)) { const auto removeElementResult = TrackRemoveStationElement( diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 05ec9980d0..e78be80903 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -43,7 +43,7 @@ // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "14" +#define NETWORK_STREAM_VERSION "15" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 6a47357eed..3e9dac94b7 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1613,7 +1613,8 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi auto trackRemoveAction = TrackRemoveAction( trackType, 0, { newCoords, tempZ, static_cast(rotation & 3) }); trackRemoveAction.SetFlags( - GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST); + GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST + | GAME_COMMAND_FLAG_TRACK_DESIGN); GameActions::ExecuteNested(&trackRemoveAction); break; }