reorder
This commit is contained in:
@@ -125,10 +125,10 @@ public final class AStarPathFinder extends AbstractNodeCostSearch implements Hel
|
|||||||
if (actionCost <= 0 || Double.isNaN(actionCost)) {
|
if (actionCost <= 0 || Double.isNaN(actionCost)) {
|
||||||
throw new IllegalStateException(moves + " calculated implausible cost " + actionCost);
|
throw new IllegalStateException(moves + " calculated implausible cost " + actionCost);
|
||||||
}
|
}
|
||||||
|
// check destination after verifying it's not COST_INF -- some movements return a static IMPOSSIBLE object with COST_INF and destination being 0,0,0 to avoid allocating a new result for every failed calculation
|
||||||
if (moves.dynamicXZ && !worldBorder.entirelyContains(res.x, res.z)) { // see issue #218
|
if (moves.dynamicXZ && !worldBorder.entirelyContains(res.x, res.z)) { // see issue #218
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// check destination after verifying it's not COST_INF -- some movements return a static IMPOSSIBLE object with COST_INF and destination being 0,0,0 to avoid allocating a new result for every failed calculation
|
|
||||||
if (!moves.dynamicXZ && (res.x != newX || res.z != newZ)) {
|
if (!moves.dynamicXZ && (res.x != newX || res.z != newZ)) {
|
||||||
throw new IllegalStateException(moves + " " + res.x + " " + newX + " " + res.z + " " + newZ);
|
throw new IllegalStateException(moves + " " + res.x + " " + newX + " " + res.z + " " + newZ);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user