Browse Source

Fix: 'Restart Scenario' button should work properly

Dmitry Orlov 4 years ago
parent
commit
3add3156e2
2 changed files with 9 additions and 0 deletions
  1. 7 0
      client/CServerHandler.cpp
  2. 2 0
      server/CVCMIServer.cpp

+ 7 - 0
client/CServerHandler.cpp

@@ -451,6 +451,13 @@ void CServerHandler::sendStartGame(bool allowOnlyAI) const
 {
 	verifyStateBeforeStart(allowOnlyAI ? true : settings["session"]["onlyai"].Bool());
 	LobbyStartGame lsg;
+	if(client)
+	{
+		lsg.initializedStartInfo = std::make_shared<StartInfo>(* const_cast<StartInfo *>(client->getStartInfo(true)));
+		lsg.initializedStartInfo->mode = StartInfo::NEW_GAME;
+		lsg.initializedStartInfo->seedToBeUsed = lsg.initializedStartInfo->seedPostInit = 0;
+		* si = * lsg.initializedStartInfo;
+	}
 	sendLobbyPack(lsg);
 }
 

+ 2 - 0
server/CVCMIServer.cpp

@@ -228,6 +228,8 @@ void CVCMIServer::prepareToStartGame()
 	if(state == EServerState::GAMEPLAY)
 	{
 		restartGameplay = true;
+		* si = * gh->gs->initialOpts;
+		si->seedToBeUsed = si->seedPostInit = 0;
 		state = EServerState::LOBBY;
 		// FIXME: dirry hack to make sure old CGameHandler::run is finished
 		boost::this_thread::sleep(boost::posix_time::milliseconds(1000));