- from SavedBattleGame::getPatrolNode()
for (int i = 0; i < end; ++i)
{
if (!scout && fromNode->getNodeLinks()->at(i) < 1) continue;
Node *n = getNodes()->at(scout ? i : fromNode->getNodeLinks()->at(i));
if ((n->getFlags() > 0 || n->getRank() > 0 || scout) https:// for non-scouts we find a node with a desirability above 0
&& (!(n->getType() & Node::TYPE_SMALL)
|| unit->getArmor()->getSize() == 1) https:// the small unit bit is not set or the unit is small
&& (!(n->getType() & Node::TYPE_FLYING)
|| unit->getArmor()->getMovementType() == MT_FLY) https:// the flying unit bit is not set or the unit can fly
&& !n->isAllocated() https:// check if not allocated
&& !(n->getType() & Node::TYPE_DANGEROUS) https:// don't go there if an alien got shot there; stupid behavior like that
&& setUnitPosition(unit, n->getPosition(), true) https:// check if not already occupied
&& getTile(n->getPosition()) && !getTile(n->getPosition())->getFire() https:// you are not a firefighter; do not patrol into fire
&& (!scout || n != fromNode) https:// scouts push forward
&& n->getPosition().x > 0 && n->getPosition().y > 0)
{
if (!preferred
|| (preferred->getRank() == Node::nodeRank[unit->getRankInt()][0] && preferred->getFlags() < n->getFlags())
|| preferred->getFlags() < n->getFlags()) preferred = n;
{
compliantNodes.push_back(n);
}
}
}
preferred = n is hiding...
Even more confusing is that, although a change to SavedBattleGame.cpp shows up for me in the commit, "speed up alien turn somewhat" to Sup/master, this file didn't automatically merge to my personal branch, unlike AlienBAIState & CivilianBAIState which merged fine. so, Given the alleged confusion regarding preferred = n I'm wondering which is correct:
https:// pre-commit
getPathfinding()->calculate(unit, n->getPosition());
if (getPathfinding()->getStartDirection() != -1)
{
compliantNodes.push_back(n);
}
getPathfinding()->abortPath();
https:// or, simply
https:// post-commit
compliantNodes.push_back(n);
i Assume the latter, but figure a closer look'd be good too, if only for better formatting.