From 0d4b901452af36576fda61e5d6ad030062ddcb10 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Wed, 17 Apr 2024 21:29:28 +0200 Subject: [PATCH] Codechange: skip all commands of the past during desync replay --- src/network/network.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/network/network.cpp b/src/network/network.cpp index 2b0a79ba16..3298107875 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -1151,6 +1151,16 @@ void NetworkGameLoop() } } + /* Skip all entries in the command-log till we caught up with the current game again. */ + if (TimerGameEconomy::date > next_date || (TimerGameEconomy::date == next_date && TimerGameEconomy::date_fract > next_date_fract)) { + Debug(desync, 0, "Skipping to next command at {:08x}:{:02x}", next_date, next_date_fract); + if (cp != nullptr) { + delete cp; + cp = nullptr; + } + check_sync_state = false; + } + if (cp != nullptr || check_sync_state) break; char buff[4096];