mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-28 03:57:02 +02:00
CPathfinder: optimize checks order in calculatePaths
This commit is contained in:
parent
8217eb3a82
commit
5a87f58e09
@ -96,8 +96,6 @@ void CPathfinder::calculatePaths()
|
|||||||
cp = pq.top();
|
cp = pq.top();
|
||||||
pq.pop();
|
pq.pop();
|
||||||
cp->locked = true;
|
cp->locked = true;
|
||||||
ct = &gs->map->getTile(cp->coord);
|
|
||||||
ctObj = ct->topVisitableObj(isSourceInitialPosition());
|
|
||||||
|
|
||||||
int movement = cp->moveRemains, turn = cp->turns;
|
int movement = cp->moveRemains, turn = cp->turns;
|
||||||
hlp->updateTurnInfo(turn);
|
hlp->updateTurnInfo(turn);
|
||||||
@ -105,7 +103,11 @@ void CPathfinder::calculatePaths()
|
|||||||
{
|
{
|
||||||
hlp->updateTurnInfo(++turn);
|
hlp->updateTurnInfo(++turn);
|
||||||
movement = hlp->getMaxMovePoints(cp->layer);
|
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
|
//add accessible neighbouring nodes to the queue
|
||||||
addNeighbours();
|
addNeighbours();
|
||||||
@ -122,13 +124,10 @@ void CPathfinder::calculatePaths()
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
dp = out.getNode(neighbour, i);
|
dp = out.getNode(neighbour, i);
|
||||||
if(dp->accessible == CGPathNode::NOT_SET)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(dp->locked)
|
if(dp->locked)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(!passOneTurnLimitCheck(cp->turns != turn))
|
if(dp->accessible == CGPathNode::NOT_SET)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(cp->layer != i && !isLayerTransitionPossible())
|
if(cp->layer != i && !isLayerTransitionPossible())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user