From ea49b8cf407e4f096dce30d86eb5d972d9356369 Mon Sep 17 00:00:00 2001 From: nordsoft Date: Thu, 6 Oct 2022 17:56:54 +0400 Subject: [PATCH] Cleanup code --- client/CServerHandler.cpp | 2 +- client/Client.cpp | 9 --------- client/Client.h | 4 ---- client/NetPacksClient.cpp | 2 -- config/translate.json | 3 ++- server/CVCMIServer.cpp | 6 +++--- 6 files changed, 6 insertions(+), 20 deletions(-) diff --git a/client/CServerHandler.cpp b/client/CServerHandler.cpp index 71de5031d..d08ac9c83 100644 --- a/client/CServerHandler.cpp +++ b/client/CServerHandler.cpp @@ -679,7 +679,7 @@ void CServerHandler::restoreLastSession() saveSession->Bool() = false; }; - CInfoWindow::showYesNoDialog("Connect to the last session?", {}, loadSession, cleanUpSession); + CInfoWindow::showYesNoDialog(VLC->generaltexth->localizedTexts["server"]["confirmReconnect"].String(), {}, loadSession, cleanUpSession); } void CServerHandler::debugStartTest(std::string filename, bool save) diff --git a/client/Client.cpp b/client/Client.cpp index 7b9a0cd22..5ee3c6cb0 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -404,15 +404,6 @@ void CClient::endGame() logNetwork->info("Client stopped."); } -void CClient::processDisconnectedPlayers() -{ - if(!gs || !disconnectedPlayers.count(gs->currentPlayer)) - return; - - LOCPLINT->showYesNoDialog("Waiting for player. Press Ok to save & end, cancel to kick that player", - [](){}, [](){}); -} - void CClient::initMapHandler() { // TODO: CMapHandler initialization can probably go somewhere else diff --git a/client/Client.h b/client/Client.h index 9519ad334..c35b74206 100644 --- a/client/Client.h +++ b/client/Client.h @@ -139,8 +139,6 @@ public: std::map>> additionalBattleInts; - std::set disconnectedPlayers; - boost::optional curbaction; CClient(); @@ -159,8 +157,6 @@ public: void save(const std::string & fname); void endGame(); - - void processDisconnectedPlayers(); void initMapHandler(); void initPlayerEnvironments(); diff --git a/client/NetPacksClient.cpp b/client/NetPacksClient.cpp index c4113e154..904eebb6f 100644 --- a/client/NetPacksClient.cpp +++ b/client/NetPacksClient.cpp @@ -811,8 +811,6 @@ void YourTurn::applyCl(CClient *cl) callAllInterfaces(cl, &IGameEventsReceiver::playerStartsTurn, player); callOnlyThatInterface(cl, player, &CGameInterface::yourTurn); - - cl->processDisconnectedPlayers(); } void SaveGameClient::applyCl(CClient *cl) diff --git a/config/translate.json b/config/translate.json index 687c6cf24..3352fedd3 100644 --- a/config/translate.json +++ b/config/translate.json @@ -33,7 +33,8 @@ { "existingProcess" : "Another vcmiserver process is running, please terminate it first", "modsIncompatibility" : "Required mods to load game:" - } + }, + "confirmReconnect" : "Connect to the last session?" }, "systemOptions" : { diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp index 9d83bf664..cadd3a0c2 100644 --- a/server/CVCMIServer.cpp +++ b/server/CVCMIServer.cpp @@ -206,10 +206,10 @@ void CVCMIServer::threadAnnounceLobby() announcePack(std::move(announceQueue.front())); announceQueue.pop_front(); } - if(state != EServerState::LOBBY) + if(state != EServerState::LOBBY && hangingConnections.empty()) { - //if(acceptor) - //acceptor->close(); + if(acceptor) + acceptor->close(); } if(acceptor)