1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-29 00:41:38 +02:00

- Implemented hero recreate handling correctly

This commit is contained in:
beegee1
2014-02-23 13:52:06 +00:00
parent 458ba47965
commit d0a5a6eab4
4 changed files with 30 additions and 20 deletions

View File

@ -2823,24 +2823,10 @@ std::vector<CGameState::CampaignHeroReplacement> CGameState::generateCampaignHer
return hero->subID == heroPlaceholder->subID;
});
CGHeroInstance * hero = nullptr;
if(it == crossoverHeroes.heroesFromAnyPreviousScenarios.end())
if(it != crossoverHeroes.heroesFromAnyPreviousScenarios.end())
{
if(scenarioOps->campState->camp->header.mapVersion == 12) // AB:AB campaign
{
// special case for this campaign, not found heroes will be newly created
hero = new CGHeroInstance();
hero->initHero(HeroTypeID(heroPlaceholder->subID));
}
}
else
{
hero = *it;
auto hero = *it;
crossoverHeroes.removeHeroFromBothLists(hero);
}
if(hero)
{
campaignHeroReplacements.push_back(CampaignHeroReplacement(hero, heroPlaceholder->id));
}
}