Class Pathfinder

java.lang.Object
games.stendhal.server.core.pathfinder.Pathfinder
Direct Known Subclasses:
SimplePathfinder

public abstract class Pathfinder extends Object
Implements the A* algorithm. Pathing can be done on any class that implements the Navigable interface. See org.generation5.ai.Navigable.
Author:
James Matthews
  • Field Details

  • Constructor Details

    • Pathfinder

      protected Pathfinder(int startX, int startY, Rectangle2D destination, double maxDist)
  • Method Details

    • init

      protected void init()
      Initialization that can not be done safely in the constructor.
    • getStatus

      protected int getStatus()
      Return the current status of the pathfinder.
      Returns:
      the pathfinder status.
      See Also:
      • pathStatus
    • getPath

      public final List<Node> getPath()
    • unreachableGoal

      protected boolean unreachableGoal()
      Checks if the goal is unreachable. Only the outer nodes of the goal are checked. There could be other reasons, why a goal is unreachable.
      Returns:
      true checks if the goal is unreachable
    • createNode

      public abstract Pathfinder.TreeNode createNode(int x, int y)
      Create a new TreeNode
      Parameters:
      x - x coordinate of the node
      y - y coordinate of the node
      Returns:
      TreeNode