1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Preserve chosen campaign bonus on scenario restart request

This commit is contained in:
Ivan Savenko 2023-08-11 16:53:02 +03:00
parent b2de5d32d1
commit 775e5948ec

View File

@ -277,6 +277,12 @@ void CVCMIServer::prepareToRestart()
* si = * gh->gs->initialOpts;
si->seedToBeUsed = si->seedPostInit = 0;
state = EServerState::LOBBY;
if (si->campState)
{
assert(si->campState->currentScenario().has_value());
campaignMap = si->campState->currentScenario().value_or(CampaignScenarioID(0));
campaignBonus = si->campState->getBonusID(campaignMap).value_or(-1);
}
// FIXME: dirry hack to make sure old CGameHandler::run is finished
boost::this_thread::sleep(boost::posix_time::milliseconds(1000));
}