mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-25 12:14:46 +02:00
Fixes #2016 (heroes not possible to be chosen in pregame after switching town selection);
Fixes skipping first hero selection when switching them with left arrow; Fixes redrawing random hero portrait correctly after switching that player to AI;
This commit is contained in:
parent
a90d603c16
commit
ad8a6c55d7
@ -2317,7 +2317,10 @@ void OptionsTab::nextCastle( PlayerColor player, int dir )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(s.hero >= 0 && !SEL->current->mapHeader->players[s.color.getNum()].hasCustomMainHero()) // remove hero unless it set to fixed one in map editor
|
if(s.hero >= 0 && !SEL->current->mapHeader->players[s.color.getNum()].hasCustomMainHero()) // remove hero unless it set to fixed one in map editor
|
||||||
|
{
|
||||||
|
usedHeroes.erase(s.hero);
|
||||||
s.hero = PlayerSettings::RANDOM;
|
s.hero = PlayerSettings::RANDOM;
|
||||||
|
}
|
||||||
if(cur < 0 && s.bonus == PlayerSettings::RESOURCE)
|
if(cur < 0 && s.bonus == PlayerSettings::RESOURCE)
|
||||||
s.bonus = PlayerSettings::RANDOM;
|
s.bonus = PlayerSettings::RANDOM;
|
||||||
|
|
||||||
@ -2352,7 +2355,7 @@ void OptionsTab::nextHero( PlayerColor player, int dir )
|
|||||||
if(dir > 0)
|
if(dir > 0)
|
||||||
s.hero = nextAllowedHero(player, s.hero, CGI->heroh->heroes.size(), 1, dir);
|
s.hero = nextAllowedHero(player, s.hero, CGI->heroh->heroes.size(), 1, dir);
|
||||||
else
|
else
|
||||||
s.hero = nextAllowedHero(player, 0, s.hero, 1, dir);
|
s.hero = nextAllowedHero(player, -1, s.hero, 1, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(old != s.hero)
|
if(old != s.hero)
|
||||||
@ -2530,6 +2533,7 @@ void OptionsTab::flagPressed( PlayerColor color )
|
|||||||
usedHeroes.erase(old->hero);
|
usedHeroes.erase(old->hero);
|
||||||
|
|
||||||
old->hero = entries[old->color]->pi.defaultHero();
|
old->hero = entries[old->color]->pi.defaultHero();
|
||||||
|
entries[old->color]->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
SEL->propagateOptions();
|
SEL->propagateOptions();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user