1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

One step forward

This commit is contained in:
nordsoft 2022-10-04 02:25:22 +04:00
parent 512cf014aa
commit b91bb41a80
4 changed files with 12 additions and 5 deletions

View File

@ -359,7 +359,9 @@ void PlayerReinitInterface::applyCl(CClient * cl)
else
{
plSettings.connectedPlayerIDs.insert(playerConnectionId);
cl->initPlayerInterfaces();
callAllInterfaces(cl, &IGameEventsReceiver::playerStartsTurn, player);
//if(cl->gameState()->currentPlayer == player)
callOnlyThatInterface(cl, player, &CGameInterface::yourTurn);
}
}

View File

@ -113,9 +113,11 @@ bool LobbyStartGame::applyOnLobbyHandler(CServerHandler * handler)
return false;
handler->state = EClientState::STARTING;
if(handler->si->mode != StartInfo::LOAD_GAME)
if(handler->si->mode != StartInfo::LOAD_GAME || clientId == handler->c->connectionID)
{
auto modeBackup = handler->si->mode;
handler->si = initializedStartInfo;
handler->si->mode = modeBackup;
}
if(settings["session"]["headless"].Bool())
handler->startGameplay(initializedGameState);

View File

@ -370,6 +370,11 @@ DLL_LINKAGE void PlayerReinitInterface::applyGs(CGameState *gs)
if(!gs || !gs->scenarioOps)
return;
gs->currentPlayer = player;
//auto & playerState = gs->players[player];
//playerState.daysWithoutCastle = daysWithoutCastle;
//TODO: what does mean if more that one player connected?
//gs->scenarioOps->getIthPlayersSettings(player).connectedPlayerIDs.clear();
}

View File

@ -52,8 +52,10 @@ void LobbyClientConnected::applyOnServerAfterAnnounce(CVCMIServer * srv)
// FIXME: we need to avoid senting something to client that not yet get answer for LobbyClientConnected
// Until UUID set we only pass LobbyClientConnected to this client
c->uuid = uuid;
srv->updateAndPropagateLobbyState();
if(srv->state == EServerState::GAMEPLAY)
{
//immediately start game
std::unique_ptr<LobbyStartGame> startGameForReconnectedPlayer(new LobbyStartGame);
startGameForReconnectedPlayer->initializedStartInfo = srv->si;
@ -61,10 +63,6 @@ void LobbyClientConnected::applyOnServerAfterAnnounce(CVCMIServer * srv)
startGameForReconnectedPlayer->clientId = c->connectionID;
srv->addToAnnounceQueue(std::move(startGameForReconnectedPlayer));
}
else
{
srv->updateAndPropagateLobbyState();
}
}
bool LobbyClientDisconnected::checkClientPermissions(CVCMIServer * srv) const