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

Fix: 'Restart Scenario' button should work properly

This commit is contained in:
Dmitry Orlov 2021-01-20 21:29:50 +03:00
parent 98fdf909e8
commit 3add3156e2
2 changed files with 9 additions and 0 deletions

View File

@ -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);
}

View File

@ -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));