From 7744fc71e42e0a8540ab2da9fb04f63c1a12e2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= Date: Sun, 17 Nov 2019 23:26:32 +0100 Subject: [PATCH] Fix #10256: Desync because of client advancing ahead of server ticks during map change (#10257) --- distribution/changelog.txt | 1 + src/openrct2/GameState.cpp | 6 ++++++ src/openrct2/network/Network.cpp | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 311dc0814a..b719b7f169 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -37,6 +37,7 @@ - Fix: [#10106] Ride circuits should not be used for modes that do not support it. - Fix: [#10149] Desync in headless mode with rides that create smoke particles. - Fix: [#10249] Desync because of ride crashes and simulation mode. +- Fix: [#10256] Desync because of advancing ahead of server ticks during map change. - Improved: [#9466] Add the rain weather effect to the OpenGL renderer. - Improved: [#9987] Minimum load rounding. - Improved: [#10125] Better support for high DPI screens. diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index 38f0c82caa..4bad6fadbf 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -245,6 +245,12 @@ void GameState::UpdateLogic() } else if (network_get_mode() == NETWORK_MODE_CLIENT) { + // Don't run past the server, this condition can happen during map changes. + if (network_get_server_tick() == gCurrentTicks) + { + return; + } + // Check desync. bool desynced = network_check_desynchronisation(); if (desynced) diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index 5e5903943d..6d109d56f5 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -31,7 +31,7 @@ // This string specifies which version of network stream current build uses. // 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 static Peep* _pickup_peep = nullptr;