GeoEngine infinite loop precautions and cleanup.
This commit is contained in:
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -827,7 +827,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -878,7 +879,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +134,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -183,7 +184,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -827,7 +827,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -878,7 +879,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,7 +134,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -183,7 +184,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -841,7 +841,8 @@ public class GeoEngine
|
||||
int ny = gpy;
|
||||
|
||||
// loop
|
||||
do
|
||||
int count = 0;
|
||||
while (count++ < Config.MAX_ITERATIONS)
|
||||
{
|
||||
direction = 0;
|
||||
|
||||
@ -892,7 +893,8 @@ public class GeoEngine
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
}
|
||||
while (true);
|
||||
|
||||
return new GeoLocation(gox, goy, goz);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
GeoLocation nodeB = (GeoLocation) point.next();
|
||||
|
||||
// iterate thought the path to optimize it
|
||||
while (point.hasNext())
|
||||
int count = 0;
|
||||
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get node C
|
||||
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
|
||||
@ -184,7 +185,8 @@ final class GeoEnginePathfinding extends GeoEngine
|
||||
Node parent = target.getParent();
|
||||
|
||||
// while parent exists
|
||||
while (parent != null)
|
||||
int count = 0;
|
||||
while ((parent != null) && (count++ < Config.MAX_ITERATIONS))
|
||||
{
|
||||
// get parent <> target direction X/Y
|
||||
final int nx = parent.getLoc().getGeoX() - target.getLoc().getGeoX();
|
||||
|
@ -39,10 +39,6 @@ public class NodeBuffer
|
||||
private int _gty = 0;
|
||||
private short _gtz = 0;
|
||||
|
||||
// pathfinding statistics
|
||||
private long _timeStamp = 0;
|
||||
private long _lastElapsedTime = 0;
|
||||
|
||||
private Node _current = null;
|
||||
|
||||
/**
|
||||
@ -77,9 +73,6 @@ public class NodeBuffer
|
||||
*/
|
||||
public final Node findPath(int gox, int goy, short goz, int gtx, int gty, short gtz)
|
||||
{
|
||||
// load timestamp
|
||||
_timeStamp = System.currentTimeMillis();
|
||||
|
||||
// set coordinates (middle of the line (gox,goy) - (gtx,gty), will be in the center of the buffer)
|
||||
_cx = gox + ((gtx - gox - _size) / 2);
|
||||
_cy = goy + ((gty - goy - _size) / 2);
|
||||
@ -106,7 +99,7 @@ public class NodeBuffer
|
||||
// move pointer
|
||||
_current = _current.getChild();
|
||||
}
|
||||
while ((_current != null) && (++count < Config.MAX_ITERATIONS));
|
||||
while ((_current != null) && (count++ < Config.MAX_ITERATIONS));
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -132,12 +125,6 @@ public class NodeBuffer
|
||||
}
|
||||
|
||||
_lock.unlock();
|
||||
_lastElapsedTime = System.currentTimeMillis() - _timeStamp;
|
||||
}
|
||||
|
||||
public final long getElapsedTime()
|
||||
{
|
||||
return _lastElapsedTime;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user