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:
parent
475a20124f
commit
4386339354
@ -312,11 +312,10 @@ void CGameState::initNewGame(const IMapService * mapService, bool allowSavingRan
|
|||||||
std::unique_ptr<CMap> randomMap = mapGenerator.generate();
|
std::unique_ptr<CMap> randomMap = mapGenerator.generate();
|
||||||
progressTracking.exclude(mapGenerator);
|
progressTracking.exclude(mapGenerator);
|
||||||
|
|
||||||
map = randomMap.release();
|
|
||||||
// Update starting options
|
// 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())
|
if(playerInfo.canAnyonePlay())
|
||||||
{
|
{
|
||||||
PlayerSettings & playerSettings = scenarioOps->playerInfos[PlayerColor(i)];
|
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());
|
logGlobal->info("Generated random map in %i ms.", sw.getDiff());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user