v0.4.2: fixed bugs and corrected logic to pathfinder
This commit is contained in:
@@ -1045,7 +1045,7 @@ public class Hero extends Char {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
boolean newPath = false;
|
boolean newPath = false;
|
||||||
if (path == null || path.isEmpty())
|
if (path == null || path.isEmpty() || !Dungeon.level.adjacent(pos, path.getFirst()))
|
||||||
newPath = true;
|
newPath = true;
|
||||||
else if (path.getLast() != target)
|
else if (path.getLast() != target)
|
||||||
newPath = true;
|
newPath = true;
|
||||||
|
|||||||
@@ -307,12 +307,13 @@ public abstract class Mob extends Char {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
boolean newPath = false;
|
boolean newPath = false;
|
||||||
if (path == null || path.isEmpty())
|
if (path == null || path.isEmpty() || !Dungeon.level.adjacent(pos, path.getFirst()))
|
||||||
newPath = true;
|
newPath = true;
|
||||||
else if (path.getLast() != target) {
|
else if (path.getLast() != target) {
|
||||||
//if the new target is adjacent to the end of the path, adjust for that
|
//if the new target is adjacent to the end of the path, adjust for that
|
||||||
//rather than scrapping the whole path
|
//rather than scrapping the whole path. Unless the path is very long,
|
||||||
if (Dungeon.level.adjacent(target, path.getLast())) {
|
//in which case re-checking will likely result in a much better path
|
||||||
|
if (Dungeon.level.adjacent(target, path.getLast()) && path.size() < viewDistance) {
|
||||||
int last = path.removeLast();
|
int last = path.removeLast();
|
||||||
|
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user