mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
API for wandering heroes access
This commit is contained in:
@@ -150,3 +150,30 @@ void PlayerLocalState::setHeroAwaken(const CGHeroInstance * hero)
|
||||
|
||||
vstd::erase(sleepingHeroes, hero);
|
||||
}
|
||||
|
||||
const std::vector<const CGHeroInstance *> & PlayerLocalState::getWanderingHeroes()
|
||||
{
|
||||
return wanderingHeroes;
|
||||
}
|
||||
|
||||
const CGHeroInstance * PlayerLocalState::getWanderingHero(size_t index)
|
||||
{
|
||||
if (index < wanderingHeroes.size())
|
||||
return wanderingHeroes[index];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void PlayerLocalState::addWanderingHero(const CGHeroInstance * hero)
|
||||
{
|
||||
assert(hero);
|
||||
assert(!vstd::contains(wanderingHeroes, hero));
|
||||
wanderingHeroes.push_back(hero);
|
||||
}
|
||||
|
||||
void PlayerLocalState::removeWanderingHero(const CGHeroInstance * hero)
|
||||
{
|
||||
assert(hero);
|
||||
assert(vstd::contains(wanderingHeroes, hero));
|
||||
vstd::erase(wanderingHeroes, hero);
|
||||
vstd::erase(sleepingHeroes, hero);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user