mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-04 00:38:11 +00:00
Use the Positions hashcode implementation and utilize toStringHelper within Node.
This commit is contained in:
@@ -5,6 +5,8 @@ import java.util.Optional;
|
||||
|
||||
import org.apollo.game.model.Position;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
|
||||
/**
|
||||
* A node representing a weighted {@link Position}.
|
||||
*
|
||||
@@ -100,7 +102,7 @@ final class Node {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return position.getX() * 31 + position.getY();
|
||||
return position.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,8 +143,7 @@ final class Node {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Node.class.getSimpleName() + " [x=" + position.getX() + ", y=" + position.getY() + ", open=" + open + ", cost="
|
||||
+ cost + "]";
|
||||
return MoreObjects.toStringHelper(this).add("position", position).add("open", open).add("cost", cost).toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import org.apollo.game.model.Position;
|
||||
|
||||
/**
|
||||
* A very simple pathfinding algorithm that simply walks in the direction of the target until it either reaches it or is
|
||||
* blocked. TODO diagonal movement support.
|
||||
* blocked.
|
||||
*
|
||||
* @author Major
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user