1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

CPathfinder: optimize checks order in calculatePaths

This commit is contained in:
ArseniyShestakov 2015-11-22 06:23:54 +03:00
parent 8217eb3a82
commit 5a87f58e09

View File

@ -96,8 +96,6 @@ void CPathfinder::calculatePaths()
cp = pq.top();
pq.pop();
cp->locked = true;
ct = &gs->map->getTile(cp->coord);
ctObj = ct->topVisitableObj(isSourceInitialPosition());
int movement = cp->moveRemains, turn = cp->turns;
hlp->updateTurnInfo(turn);
@ -105,7 +103,11 @@ void CPathfinder::calculatePaths()
{
hlp->updateTurnInfo(++turn);
movement = hlp->getMaxMovePoints(cp->layer);
if(!passOneTurnLimitCheck(true))
continue;
}
ct = &gs->map->getTile(cp->coord);
ctObj = ct->topVisitableObj(isSourceInitialPosition());
//add accessible neighbouring nodes to the queue
addNeighbours();
@ -122,13 +124,10 @@ void CPathfinder::calculatePaths()
continue;
dp = out.getNode(neighbour, i);
if(dp->accessible == CGPathNode::NOT_SET)
continue;
if(dp->locked)
continue;
if(!passOneTurnLimitCheck(cp->turns != turn))
if(dp->accessible == CGPathNode::NOT_SET)
continue;
if(cp->layer != i && !isLayerTransitionPossible())