Class PendingDirections
java.lang.Object
com.realtime.crossfire.jxclient.map.PendingDirections
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int direction, int packetNo) Adds a pending step.voidclear()Clears the state.voidcomc(int packetNo) Must be called when a comc message has been received from the server.Returns the currently pending directions.intReturns the direction the character is running.voidmapScroll(int direction) Must be called when the map has been scrolled.voidrun(int direction) Sets the directions the character is currently running to.voidtick()Must be called when a tick message has been received.@NotNull StringtoString()
-
Constructor Details
-
PendingDirections
public PendingDirections()Creates a new instance.
-
-
Method Details
-
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 steppacketNo- 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
-