1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

CPathfinder: move one more check into isMovementPossible

This commit is contained in:
ArseniyShestakov 2015-10-24 12:09:57 +03:00
parent 6ebe2abc1a
commit 5a04f05b9b

View File

@ -3477,10 +3477,9 @@ void CPathfinder::calculatePaths()
remains = moveAtNextTile - cost;
}
if((dp->turns==0xff //we haven't been here before
if(dp->turns==0xff //we haven't been here before
|| dp->turns > turnAtNextTile
|| (dp->turns >= turnAtNextTile && dp->moveRemains < remains)) //this route is faster
&& (!isSourceGuarded() || isDestinationGuardian())) // Can step into tile of guard
{
assert(dp != cp->theNodeBefore); //two tiles can't point to each other
dp->moveRemains = remains;
@ -3596,6 +3595,9 @@ bool CPathfinder::isMovementPossible()
}
}
if(isSourceGuarded() && !isDestinationGuardian()) // Can step into tile of guard
return false;
return true;
}