Browse Source

Revert "Fix incrementing PlayerConnectionID"

This reverts commit 48a683ae49bd38fc2f50021806eeaf755881e9bf.
Michał Zaremba 2 weeks ago
parent
commit
35543bef7a
1 changed files with 4 additions and 7 deletions
  1. 4 7
      server/CVCMIServer.cpp

+ 4 - 7
server/CVCMIServer.cpp

@@ -446,20 +446,18 @@ void CVCMIServer::clientConnected(std::shared_ptr<GameConnection> c, std::vector
 		si->mode = mode;
 	}
 
-	auto connID = static_cast<int>(c->connectionID);
+	logNetwork->info("Connection with client %d established. UUID: %s", static_cast<int>(c->connectionID), c->uuid);
 
-	logNetwork->info("Connection with client %d established. UUID: %s", connID, c->uuid);
-
-	PlayerConnectionID id = currentPlayerId;
 	for(auto & name : names)
 	{
-		logNetwork->info("Client %d player: %s", connID, name);
+		logNetwork->info("Client %d player: %s", static_cast<int>(c->connectionID), name);
+		PlayerConnectionID id = vstd::next(currentPlayerId, 1);
 
 		ClientPlayer cp;
 		cp.connection = c->connectionID;
 		cp.name = name;
 		playerNames.try_emplace(id, cp);
-		announceTxt(boost::str(boost::format("%s (pid %d cid %d) joins the game") % name % static_cast<int>(id) % connID));
+		announceTxt(boost::str(boost::format("%s (pid %d cid %d) joins the game") % name % static_cast<int>(id) % static_cast<int>(c->connectionID)));
 
 		//put new player in first slot with AI
 		for(auto & elem : si->playerInfos)
@@ -470,7 +468,6 @@ void CVCMIServer::clientConnected(std::shared_ptr<GameConnection> c, std::vector
 				break;
 			}
 		}
-		id = vstd::next(id, 1);
 	}
 }