1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Fix Orrin as starting hero on some maps

Fixes a bug that led to Orrin being replaced with a different randomly
selected hero on maps where starting hero is not generated in town, but
pre-placed on map
This commit is contained in:
Ivan Savenko
2024-11-24 20:05:34 +00:00
parent a4417f3fc5
commit 1116c18af5
2 changed files with 4 additions and 2 deletions

View File

@ -62,7 +62,7 @@ boost::shared_mutex CGameState::mutex;
HeroTypeID CGameState::pickNextHeroType(const PlayerColor & owner)
{
const PlayerSettings &ps = scenarioOps->getIthPlayersSettings(owner);
if(ps.hero >= HeroTypeID(0) && !isUsedHero(HeroTypeID(ps.hero))) //we haven't used selected hero
if(ps.hero.isValid() && !isUsedHero(HeroTypeID(ps.hero))) //we haven't used selected hero
{
return HeroTypeID(ps.hero);
}