1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Fix random map generation

This commit is contained in:
Ivan Savenko
2025-04-10 16:02:51 +03:00
parent 912c2eae94
commit f5f8ed192b
4 changed files with 56 additions and 22 deletions

View File

@ -109,7 +109,9 @@ void HeroPoolProcessor::selectNewHeroForSlot(const PlayerColor & color, TavernHe
sah.slotID = slot;
sah.replenishPoints = true;
CGHeroInstance *newHero = (nextHero == HeroTypeID::NONE) ? pickHeroFor(needNativeHero, color) : gameHandler->gameState()->heroesPool->unusedHeroesFromPool()[nextHero];
CGHeroInstance *newHero = nextHero.hasValue()?
gameHandler->gameState()->heroesPool->unusedHeroesFromPool()[nextHero]:
pickHeroFor(needNativeHero, color);
if (newHero)
{