Renamed mStoredAvailableNodes to mPopulateAvailableNodes.

Don't call getAllowedNodes() needlessly.
This commit is contained in:
dteviot 2015-07-12 16:32:48 +12:00
parent 11d24fd23b
commit b508846a64
2 changed files with 9 additions and 8 deletions

View file

@ -117,7 +117,7 @@ namespace MWMechanics
mStartTime = MWBase::Environment::get().getWorld()->getTimeStamp(); mStartTime = MWBase::Environment::get().getWorld()->getTimeStamp();
mStoredAvailableNodes = false; mPopulateAvailableNodes = true;
} }
@ -191,7 +191,7 @@ namespace MWMechanics
if(!currentCell || cellChange) if(!currentCell || cellChange)
{ {
currentCell = actor.getCell(); currentCell = actor.getCell();
mStoredAvailableNodes = false; // prob. not needed since mDistance = 0 mPopulateAvailableNodes = true;
} }
cStats.setDrawState(DrawState_Nothing); cStats.setDrawState(DrawState_Nothing);
@ -390,7 +390,7 @@ namespace MWMechanics
} }
// Initialization to discover & store allowed node points for this actor. // Initialization to discover & store allowed node points for this actor.
if(!mStoredAvailableNodes) if (mPopulateAvailableNodes)
{ {
getAllowedNodes(actor, currentCell->getCell()); getAllowedNodes(actor, currentCell->getCell());
} }
@ -640,7 +640,7 @@ namespace MWMechanics
if (mDistance == 0) if (mDistance == 0)
return; return;
if (!mStoredAvailableNodes) if (mPopulateAvailableNodes)
getAllowedNodes(actor, actor.getCell()->getCell()); getAllowedNodes(actor, actor.getCell()->getCell());
if (mAllowedNodes.empty()) if (mAllowedNodes.empty())
@ -660,7 +660,7 @@ namespace MWMechanics
actor.getClass().adjustPosition(actor, false); actor.getClass().adjustPosition(actor, false);
// may have changed cell // may have changed cell
mStoredAvailableNodes = false; mPopulateAvailableNodes = true;
} }
int AiWander::OffsetToPreventOvercrowding() int AiWander::OffsetToPreventOvercrowding()
@ -722,8 +722,9 @@ namespace MWMechanics
{ {
SetCurrentNodeToClosestAllowedNode(npcPos); SetCurrentNodeToClosestAllowedNode(npcPos);
} }
mStoredAvailableNodes = true; // set only if successful in finding allowed nodes
} }
mPopulateAvailableNodes = false;
} }
// When only one path grid point in wander distance, // When only one path grid point in wander distance,

View file

@ -88,8 +88,8 @@ namespace MWMechanics
// if false triggers calculating allowed nodes based on mDistance // do we need to calculate allowed nodes based on mDistance
bool mStoredAvailableNodes; bool mPopulateAvailableNodes;