mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-17 11:56:46 +02:00
Fix duplicated hero in Song for the Father campaign
This commit is contained in:
parent
a920cc740f
commit
c3012105e2
@ -210,17 +210,21 @@ void CGameStateCampaign::placeCampaignHeroes()
|
|||||||
// with the same hero type id
|
// with the same hero type id
|
||||||
std::vector<CGHeroInstance *> removedHeroes;
|
std::vector<CGHeroInstance *> removedHeroes;
|
||||||
|
|
||||||
std::set<HeroTypeID> heroesToRemove = campaignState->getReservedHeroes();
|
std::set<HeroTypeID> reservedHeroes = campaignState->getReservedHeroes();
|
||||||
|
std::set<HeroTypeID> heroesToRemove;
|
||||||
|
|
||||||
|
for (auto const & heroID : reservedHeroes )
|
||||||
|
{
|
||||||
|
// Do not replace reserved heroes initially, e.g. in 1st campaign scenario in which they appear
|
||||||
|
if (!campaignState->getHeroByType(heroID).isNull())
|
||||||
|
heroesToRemove.insert(heroID);
|
||||||
|
}
|
||||||
|
|
||||||
for(auto & campaignHeroReplacement : campaignHeroReplacements)
|
for(auto & campaignHeroReplacement : campaignHeroReplacements)
|
||||||
heroesToRemove.insert(campaignHeroReplacement.hero->getHeroType());
|
heroesToRemove.insert(campaignHeroReplacement.hero->getHeroType());
|
||||||
|
|
||||||
for(auto & heroID : heroesToRemove)
|
for(auto & heroID : heroesToRemove)
|
||||||
{
|
{
|
||||||
// Do not replace reserved heroes initially, e.g. in 1st campaign scenario in which they appear
|
|
||||||
if (campaignState->getHeroByType(heroID).isNull())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
auto * hero = gameState->getUsedHero(heroID);
|
auto * hero = gameState->getUsedHero(heroID);
|
||||||
if(hero)
|
if(hero)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user