Browse Source

Cleanup code

nordsoft 3 years ago
parent
commit
ea49b8cf40
6 changed files with 6 additions and 20 deletions
  1. 1 1
      client/CServerHandler.cpp
  2. 0 9
      client/Client.cpp
  3. 0 4
      client/Client.h
  4. 0 2
      client/NetPacksClient.cpp
  5. 2 1
      config/translate.json
  6. 3 3
      server/CVCMIServer.cpp

+ 1 - 1
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)

+ 0 - 9
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

+ 0 - 4
client/Client.h

@@ -139,8 +139,6 @@ public:
 
 	std::map<PlayerColor, std::vector<std::shared_ptr<IBattleEventsReceiver>>> additionalBattleInts;
 	
-	std::set<PlayerColor> disconnectedPlayers;
-
 	boost::optional<BattleAction> curbaction;
 
 	CClient();
@@ -159,8 +157,6 @@ public:
 
 	void save(const std::string & fname);
 	void endGame();
-	
-	void processDisconnectedPlayers();
 
 	void initMapHandler();
 	void initPlayerEnvironments();

+ 0 - 2
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)

+ 2 - 1
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" :
 	{

+ 3 - 3
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)