Class PendingDirections

java.lang.Object
com.realtime.crossfire.jxclient.map.PendingDirections

public class PendingDirections extends Object
Maintains pending movements of the character. Whenever a movement command is sent to the server, it is stored. When the server has executed the command, it is removed.

In case the server does not execute the movement command (for example because the character was stopped by an obstacle), the pending movements are cleared.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(int direction, int packetNo)
    Adds a pending step.
    void
    Clears the state.
    void
    comc(int packetNo)
    Must be called when a comc message has been received from the server.
    @NotNull Iterable<@NotNull Integer>
    Returns the currently pending directions.
    int
    Returns the direction the character is running.
    void
    mapScroll(int direction)
    Must be called when the map has been scrolled.
    void
    run(int direction)
    Sets the directions the character is currently running to.
    void
    Must be called when a tick message has been received.
    @NotNull String
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PendingDirections

      public PendingDirections()
      Creates a new instance.
  • Method Details

    • getPendingDirections

      @NotNull public @NotNull Iterable<@NotNull Integer> getPendingDirections()
      Returns the currently pending directions.
      Returns:
      the pending directions
    • getRunDirection

      public int getRunDirection()
      Returns the direction the character is running.
      Returns:
      the direction or -1 when not running
    • clear

      public void clear()
      Clears the state.
    • add

      public void add(int direction, int packetNo)
      Adds a pending step.
      Parameters:
      direction - the direction of the step
      packetNo - the packet number for tracking responses
    • run

      public void run(int direction)
      Sets the directions the character is currently running to.
      Parameters:
      direction - the direction or -1 when not running
    • comc

      public void comc(int packetNo)
      Must be called when a comc message has been received from the server.
      Parameters:
      packetNo - the packet number
    • mapScroll

      public void mapScroll(int direction)
      Must be called when the map has been scrolled.
      Parameters:
      direction - the scrolling direction
    • tick

      public void tick()
      Must be called when a tick message has been received.
    • toString

      @NotNull public @NotNull String toString()
      Overrides:
      toString in class Object