1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

added API for sleeping heroes access

This commit is contained in:
Ivan Savenko
2023-04-17 13:26:28 +03:00
parent 6a46138617
commit 3eac6f323e
4 changed files with 38 additions and 20 deletions

View File

@ -127,3 +127,26 @@ void PlayerLocalState::setSelection(const CArmedInstance *selection)
{
currentSelection = selection;
}
bool PlayerLocalState::isHeroSleeping(const CGHeroInstance * hero) const
{
return vstd::contains(sleepingHeroes, hero);
}
void PlayerLocalState::setHeroAsleep(const CGHeroInstance *hero)
{
assert(hero);
assert(vstd::contains(wanderingHeroes, hero));
assert(!vstd::contains(sleepingHeroes, hero));
sleepingHeroes.push_back(hero);
}
void PlayerLocalState::setHeroAwaken(const CGHeroInstance * hero)
{
assert(hero);
assert(vstd::contains(wanderingHeroes, hero));
assert(vstd::contains(sleepingHeroes, hero));
vstd::erase(sleepingHeroes, hero);
}