mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Merge pull request #697 from vcmi/fix-campaign-transition
3095 - fix campaign transition
This commit is contained in:
@@ -1093,12 +1093,8 @@ CGameState::CrossoverHeroesList CGameState::getCrossoverHeroesFromPreviousScenar
|
|||||||
{
|
{
|
||||||
if(!campaignState->mapsConquered.empty())
|
if(!campaignState->mapsConquered.empty())
|
||||||
{
|
{
|
||||||
std::vector<CGHeroInstance *> heroes;
|
std::vector<CGHeroInstance *> heroes = {};
|
||||||
for(auto & node : campaignState->camp->scenarios[campaignState->mapsConquered.back()].crossoverHeroes)
|
|
||||||
{
|
|
||||||
auto h = CCampaignState::crossoverDeserialize(node);
|
|
||||||
heroes.push_back(h);
|
|
||||||
}
|
|
||||||
crossoverHeroes.heroesFromAnyPreviousScenarios = crossoverHeroes.heroesFromPreviousScenario = heroes;
|
crossoverHeroes.heroesFromAnyPreviousScenarios = crossoverHeroes.heroesFromPreviousScenario = heroes;
|
||||||
crossoverHeroes.heroesFromPreviousScenario = heroes;
|
crossoverHeroes.heroesFromPreviousScenario = heroes;
|
||||||
|
|
||||||
@@ -1127,6 +1123,7 @@ CGameState::CrossoverHeroesList CGameState::getCrossoverHeroesFromPreviousScenar
|
|||||||
{
|
{
|
||||||
return hero->subID == h->subID;
|
return hero->subID == h->subID;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(it != crossoverHeroes.heroesFromAnyPreviousScenarios.end())
|
if(it != crossoverHeroes.heroesFromAnyPreviousScenarios.end())
|
||||||
{
|
{
|
||||||
// replace old hero with newer one
|
// replace old hero with newer one
|
||||||
@@ -1137,6 +1134,11 @@ CGameState::CrossoverHeroesList CGameState::getCrossoverHeroesFromPreviousScenar
|
|||||||
// add new hero
|
// add new hero
|
||||||
crossoverHeroes.heroesFromAnyPreviousScenarios.push_back(hero);
|
crossoverHeroes.heroesFromAnyPreviousScenarios.push_back(hero);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mapNr == campaignState->mapsConquered.back())
|
||||||
|
{
|
||||||
|
crossoverHeroes.heroesFromPreviousScenario.push_back(hero);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user