From 113527c80c90d6ff9411b9f5518db037a5e5aa09 Mon Sep 17 00:00:00 2001 From: Adriankhl Date: Mon, 13 Mar 2023 11:04:06 +0100 Subject: [PATCH] Fix paths deserialization --- client/Client.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/client/Client.cpp b/client/Client.cpp index 936d7e7d7..befbca574 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -310,8 +310,7 @@ void CClient::serialize(BinaryDeserializer & h, const int version) nInt->human = isHuman; nInt->playerID = pid; - nInt->loadGame(h, version); - + bool shouldResetInterface = true; // Client no longer handle this player at all if(!vstd::contains(CSH->getAllClientPlayers(CSH->c->connectionID), pid)) { @@ -328,10 +327,18 @@ void CClient::serialize(BinaryDeserializer & h, const int version) else { installNewPlayerInterface(nInt, pid); - continue; + shouldResetInterface = false; + } + + // loadGame needs to be called after initGameInterface to load paths correctly + // initGameInterface is called in installNewPlayerInterface + nInt->loadGame(h, version); + + if (shouldResetInterface) + { + nInt.reset(); + LOCPLINT = prevInt; } - nInt.reset(); - LOCPLINT = prevInt; } #if SCRIPTING_ENABLED