1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-10-31 00:07:39 +02:00

Fix incrementing conn and player IDs

This commit is contained in:
Michał Zaremba
2025-10-06 12:35:21 +02:00
parent 35543bef7a
commit 3e486a779d

View File

@@ -437,7 +437,8 @@ void CVCMIServer::clientConnected(std::shared_ptr<GameConnection> c, std::vector
{
assert(getState() == EServerState::LOBBY);
c->connectionID = vstd::next(currentClientId, 1);
c->connectionID = currentClientId;
currentClientId = vstd::next(currentClientId, 1);
c->uuid = uuid;
if(hostClientId == GameConnectionID::INVALID)
@@ -451,7 +452,8 @@ void CVCMIServer::clientConnected(std::shared_ptr<GameConnection> c, std::vector
for(auto & name : names)
{
logNetwork->info("Client %d player: %s", static_cast<int>(c->connectionID), name);
PlayerConnectionID id = vstd::next(currentPlayerId, 1);
PlayerConnectionID id = currentPlayerId;
currentPlayerId = vstd::next(currentPlayerId, 1);
ClientPlayer cp;
cp.connection = c->connectionID;