Some formatting.

Whatever: this class needs a kick to the head.
Maybe I should make a new one that isn't singleton and thread-unsafe
like this one.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@914 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Ray Greenwell
2010-04-13 20:42:26 +00:00
parent c1ba3f7d18
commit 24e3afe18f
@@ -122,8 +122,7 @@ public class AStarPathUtil
public static final int ADJACENT_COST = 10;
/** The cost to move diagonally. */
public static final int DIAGONAL_COST = (int)Math.sqrt(
(ADJACENT_COST * ADJACENT_COST) * 2);
public static final int DIAGONAL_COST = (int)Math.sqrt((ADJACENT_COST * ADJACENT_COST) * 2);
/**
* Return a list of <code>Point</code> objects representing a path from coordinates
@@ -211,8 +210,7 @@ public class AStarPathUtil
TraversalPred tpred, Object trav, int longest,
int ax, int ay, int bx, int by, boolean partial)
{
return getPath(
tpred, new Stepper(), trav, longest, ax, ay, bx, by, partial);
return getPath(tpred, new Stepper(), trav, longest, ax, ay, bx, by, partial);
}
/**
@@ -253,8 +251,7 @@ public class AStarPathUtil
// skip if it's already in the open or closed list or if its
// actual cost is less than the just-calculated cost
if ((info.open.contains(np) || info.closed.contains(np)) &&
np.g <= newg) {
if ((info.open.contains(np) || info.closed.contains(np)) && np.g <= newg) {
return;
}
@@ -340,8 +337,7 @@ public class AStarPathUtil
/** The maximum cost of any path that we'll consider. */
public int maxcost;
public Info (TraversalPred tpred, Object trav,
int longest, int destx, int desty)
public Info (TraversalPred tpred, Object trav, int longest, int destx, int desty)
{
// save off references
this.tpred = tpred;
@@ -365,15 +361,12 @@ public class AStarPathUtil
{
// not traversable if the destination itself fails test
if (tpred instanceof ExtendedTraversalPred) {
if (!((ExtendedTraversalPred)tpred).canTraverse(
trav, sx, sy, dx, dy)) {
if (!((ExtendedTraversalPred)tpred).canTraverse(trav, sx, sy, dx, dy)) {
return false;
}
} else {
if (!isTraversable(dx, dy)) {
} else if (!isTraversable(dx, dy)) {
return false;
}
}
// if the step is diagonal, make sure the corners don't impede our progress
if ((Math.abs(dx - sx) == 1) && (Math.abs(dy - sy) == 1)) {