Pārlūkot izejas kodu

Fix paths deserialization

Adriankhl 2 gadi atpakaļ
vecāks
revīzija
113527c80c
1 mainītis faili ar 12 papildinājumiem un 5 dzēšanām
  1. 12 5
      client/Client.cpp

+ 12 - 5
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