1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

vcmi: remove unused functions now

This commit is contained in:
Konstantin
2023-04-17 00:24:11 +03:00
parent 7a5775a9f9
commit 54eb550eb9
10 changed files with 79 additions and 100 deletions

View File

@@ -96,7 +96,18 @@ TGoalVec GatherTroops::getAllPossibleSubgoals()
auto creature = VLC->creatures()->getByIndex(objid);
if(t->subID == creature->getFaction()) //TODO: how to force AI to build unupgraded creatures? :O
{
auto creatures = vstd::tryAt(t->town->creatures, creature->getLevel() - 1);
auto tryFindCreature = [&]() -> std::optional<std::vector<CreatureID>>
{
if(vstd::isValidIndex(t->town->creatures, creature->getLevel() - 1))
{
auto itr = t->town->creatures.begin();
std::advance(itr, creature->getLevel() - 1);
return make_optional(*itr);
}
return std::nullopt;
};
auto creatures = tryFindCreature();
if(!creatures)
continue;