mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-23 00:28:08 +02:00
Added API for owned towns access
This commit is contained in:
@ -177,3 +177,29 @@ void PlayerLocalState::removeWanderingHero(const CGHeroInstance * hero)
|
||||
vstd::erase(wanderingHeroes, hero);
|
||||
vstd::erase(sleepingHeroes, hero);
|
||||
}
|
||||
|
||||
const std::vector<const CGTownInstance *> & PlayerLocalState::getOwnedTowns()
|
||||
{
|
||||
return ownedTowns;
|
||||
}
|
||||
|
||||
const CGTownInstance * PlayerLocalState::getOwnedTown(size_t index)
|
||||
{
|
||||
if (index < ownedTowns.size())
|
||||
return ownedTowns[index];
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void PlayerLocalState::addOwnedTown(const CGTownInstance * town)
|
||||
{
|
||||
assert(town);
|
||||
assert(!vstd::contains(ownedTowns, town));
|
||||
ownedTowns.push_back(town);
|
||||
}
|
||||
|
||||
void PlayerLocalState::removeOwnedTown(const CGTownInstance * town)
|
||||
{
|
||||
assert(town);
|
||||
assert(vstd::contains(ownedTowns, town));
|
||||
vstd::erase(ownedTowns, town);
|
||||
}
|
||||
|
Reference in New Issue
Block a user