1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Added encapsulation for CampaignState class

This commit is contained in:
Ivan Savenko
2023-06-26 00:01:25 +03:00
parent 8420a90aa4
commit a08fe09517
12 changed files with 203 additions and 127 deletions

View File

@@ -1076,21 +1076,7 @@ void PlayerEndsGame::applyGs(CGameState * gs) const
// keep all heroes from the winning player
crossoverHeroes.push_back(hero);
}
else if (vstd::contains(gs->scenarioOps->campState->getCurrentScenario().keepHeroes, HeroTypeID(hero->subID)))
{
// keep hero whether lost or won (like Xeron in AB campaign)
crossoverHeroes.push_back(hero);
}
}
// keep lost heroes which are in heroes pool
for (auto & heroPair : gs->hpool.heroesPool)
{
if (vstd::contains(gs->scenarioOps->campState->getCurrentScenario().keepHeroes, HeroTypeID(heroPair.first)))
{
crossoverHeroes.push_back(heroPair.second.get());
}
}
gs->scenarioOps->campState->setCurrentMapAsConquered(crossoverHeroes);
}
}