1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Merge pull request #2559 from IvanSavenko/campaign_bonus_fix

Preserve chosen campaign bonus on scenario restart request
This commit is contained in:
Ivan Savenko 2023-08-12 11:24:30 +03:00 committed by GitHub
commit aef8ef1d55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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