1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-02 00:10:22 +02:00

Fix crash on rmg generation (regression from previous commit)

This commit is contained in:
Ivan Savenko 2024-08-21 18:19:58 +00:00
parent 475a20124f
commit 4386339354

View File

@ -312,11 +312,10 @@ void CGameState::initNewGame(const IMapService * mapService, bool allowSavingRan
std::unique_ptr<CMap> randomMap = mapGenerator.generate();
progressTracking.exclude(mapGenerator);
map = randomMap.release();
// Update starting options
for(int i = 0; i < map->players.size(); ++i)
for(int i = 0; i < randomMap->players.size(); ++i)
{
const auto & playerInfo = map->players[i];
const auto & playerInfo = randomMap->players[i];
if(playerInfo.canAnyonePlay())
{
PlayerSettings & playerSettings = scenarioOps->playerInfos[PlayerColor(i)];
@ -363,6 +362,8 @@ void CGameState::initNewGame(const IMapService * mapService, bool allowSavingRan
}
}
map = randomMap.release();
logGlobal->info("Generated random map in %i ms.", sw.getDiff());
}
else