From f8b30fbb36e9a142f252289c01e3602582c0a5cc Mon Sep 17 00:00:00 2001 From: Rik Smeets <30838294+rik-smeets@users.noreply.github.com> Date: Sun, 2 Apr 2023 17:38:00 +0200 Subject: [PATCH] Reduce guests walking through trains on level crossing next to station (#19619) --- distribution/changelog.txt | 1 + src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/ride/Vehicle.cpp | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 9ce7c89136..dd035b2afc 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.4.5 (in development) ------------------------------------------------------------------------ +- Improved: [#18490] Reduce guests walking through trains on level crossing next to station. - Improved: [#19764] Miscellaneous scenery tab now grouped next to the all-scenery tab. - Fix: [#19296] Crash due to a race condition for parallel object loading. - Fix: [#19756] Crash with title sequences containing no commands. diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index f7cbb8ed99..56ed1993aa 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 "1" +#define NETWORK_STREAM_VERSION "2" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 1dd7cf3606..3beda10738 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -9238,7 +9238,9 @@ void Vehicle::UpdateCrossings() const xyElement.element = output.begin_element; } - if (xyElement.element->AsTrack()->IsStation()) + // Ensure trains near a station don't block possible crossings after the stop, + // except when they are departing + if (xyElement.element->AsTrack()->IsStation() && status != Vehicle::Status::Departing) { break; } @@ -9252,7 +9254,8 @@ void Vehicle::UpdateCrossings() const return; } - uint8_t freeCount = travellingForwards ? 3 : 1; + // Ensure departing trains don't clear blocked crossings behind them that might already be blocked by another incoming train + uint8_t freeCount = travellingForwards && status != Vehicle::Status::Departing ? 3 : 1; while (freeCount-- > 0) { auto* pathElement = MapGetPathElementAt(TileCoordsXYZ(CoordsXYZ{ xyElement, xyElement.element->GetBaseZ() }));