Crossfire JXClient, Trunk
R20561
|
Maintains the pending (ncom) commands sent to the server. More...
Public Member Functions | |
void | addToRepeatCount (final int digit) |
Adds a digit to the current repeat count. More... | |
boolean | checkFire () |
Returns whether the character is firing. More... | |
boolean | checkRun () |
Returns whether the character is running. More... | |
CommandQueue (@NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final GuiStateManager guiStateManager) | |
Creates a new instance. More... | |
void | resetRepeatCount () |
Resets the current repeat count to zero. More... | |
void | sendMove (final int to, final int tag) |
Sends a "move" command to the server. More... | |
void | sendNcom (final boolean mustSend, @NotNull final String command) |
Sends an "ncom" command to the server. More... | |
void | sendNcom (final boolean mustSend, final int repeat, @NotNull final String command) |
Sends an "ncom" command to the server. More... | |
boolean | stopRunning () |
Tells the server to stop running. More... | |
Private Member Functions | |
void | clear () |
Forgets about sent commands. More... | |
int | getRepeatCount () |
Returns the current repeat count and reset it to zero. More... | |
Private Attributes | |
final CrossfireComcListener | crossfireComcListener |
The listener to track comc commands. More... | |
final CrossfireServerConnection | crossfireServerConnection |
The server connection for sending ncom commands. More... | |
final GuiStateListener | guiStateListener |
The GuiStateListener for detecting established or dropped connections. More... | |
boolean | isRunning |
Whether a "run" command has been sent without a following "run_stop" command. More... | |
final List< Integer > | pendingCommands = new LinkedList<>() |
Records command ids of commands sent to the server for which no comc commands has been received. More... | |
int | repeatCount |
The default repeat counter for ncom commands. More... | |
Static Private Attributes | |
static final int | MAX_PENDING_COMMANDS = 10 |
Maximum number of pending commands sent to the server. More... | |
Maintains the pending (ncom) commands sent to the server.
Definition at line 37 of file CommandQueue.java.
com.realtime.crossfire.jxclient.queue.CommandQueue.CommandQueue | ( | @NotNull final CrossfireServerConnection | crossfireServerConnection, |
@NotNull final GuiStateManager | guiStateManager | ||
) |
Creates a new instance.
crossfireServerConnection | the server connection for sending ncom commands |
guiStateManager | the gui state manager to watch |
Definition at line 143 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.addCrossfireComcListener(), com.realtime.crossfire.jxclient.queue.CommandQueue.crossfireComcListener, com.realtime.crossfire.jxclient.queue.CommandQueue.crossfireServerConnection, and com.realtime.crossfire.jxclient.queue.CommandQueue.guiStateListener.
void com.realtime.crossfire.jxclient.queue.CommandQueue.addToRepeatCount | ( | final int | digit | ) |
Adds a digit to the current repeat count.
digit | the digit (0-9) to add |
Definition at line 170 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.queue.CommandQueue.repeatCount.
Referenced by com.realtime.crossfire.jxclient.window.KeyHandler.handleKeyPress().
boolean com.realtime.crossfire.jxclient.queue.CommandQueue.checkFire | ( | ) |
Returns whether the character is firing.
Definition at line 254 of file CommandQueue.java.
Referenced by com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.cmdRequest().
boolean com.realtime.crossfire.jxclient.queue.CommandQueue.checkRun | ( | ) |
Returns whether the character is running.
Definition at line 243 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.queue.CommandQueue.isRunning, and com.realtime.crossfire.jxclient.queue.CommandQueue.pendingCommands.
Referenced by com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.cmdRequest().
|
private |
Forgets about sent commands.
Definition at line 178 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.queue.CommandQueue.isRunning, com.realtime.crossfire.jxclient.queue.CommandQueue.pendingCommands, and com.realtime.crossfire.jxclient.queue.CommandQueue.resetRepeatCount().
|
private |
Returns the current repeat count and reset it to zero.
Definition at line 153 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.queue.CommandQueue.repeatCount, and com.realtime.crossfire.jxclient.queue.CommandQueue.resetRepeatCount().
Referenced by com.realtime.crossfire.jxclient.queue.CommandQueue.sendMove(), and com.realtime.crossfire.jxclient.queue.CommandQueue.sendNcom().
void com.realtime.crossfire.jxclient.queue.CommandQueue.resetRepeatCount | ( | ) |
Resets the current repeat count to zero.
Definition at line 162 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.queue.CommandQueue.repeatCount.
Referenced by com.realtime.crossfire.jxclient.queue.CommandQueue.clear(), and com.realtime.crossfire.jxclient.queue.CommandQueue.getRepeatCount().
void com.realtime.crossfire.jxclient.queue.CommandQueue.sendMove | ( | final int | to, |
final int | tag | ||
) |
Sends a "move" command to the server.
The repeat count value is the client's current repeat count.
to | the destination location |
tag | the item to move |
Definition at line 264 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.queue.CommandQueue.crossfireServerConnection, com.realtime.crossfire.jxclient.queue.CommandQueue.getRepeatCount(), and com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.sendMove().
Referenced by com.realtime.crossfire.jxclient.gui.item.GUIItemFloor.button3Clicked(), and com.realtime.crossfire.jxclient.gui.item.GUIItemInventory.button3Clicked().
void com.realtime.crossfire.jxclient.queue.CommandQueue.sendNcom | ( | final boolean | mustSend, |
@NotNull final String | command | ||
) |
Sends an "ncom" command to the server.
This function uses the default repeat count.
mustSend | if set, always send the command; if unset, drop the command if the command queue is full |
command | the command to send |
Definition at line 194 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.queue.CommandQueue.getRepeatCount().
Referenced by com.realtime.crossfire.jxclient.gui.item.GUIItemSpell.button1Clicked(), com.realtime.crossfire.jxclient.gui.item.GUIItemKnowledge.button1Clicked(), com.realtime.crossfire.jxclient.gui.item.GUIItemSpell.button2Clicked(), com.realtime.crossfire.jxclient.gui.item.GUIItemKnowledge.button2Clicked(), com.realtime.crossfire.jxclient.gui.item.GUIItemSpell.button3Clicked(), com.realtime.crossfire.jxclient.scripts.DefaultScriptProcess.cmdIssue(), com.realtime.crossfire.jxclient.shortcuts.ShortcutCommand.execute(), com.realtime.crossfire.jxclient.shortcuts.ShortcutSpell.execute(), com.realtime.crossfire.jxclient.commands.CommandExecutorImpl.executeCommand(), com.realtime.crossfire.jxclient.queue.CommandQueue.stopRunning(), and com.realtime.crossfire.jxclient.settings.options.Pickup.updatePickupMode().
void com.realtime.crossfire.jxclient.queue.CommandQueue.sendNcom | ( | final boolean | mustSend, |
final int | repeat, | ||
@NotNull final String | command | ||
) |
Sends an "ncom" command to the server.
mustSend | if set, always send the command; if unset, drop the command if the command queue is full |
repeat | the repeat count |
command | the command to send |
Definition at line 206 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.queue.CommandQueue.crossfireServerConnection, com.realtime.crossfire.jxclient.queue.CommandQueue.isRunning, com.realtime.crossfire.jxclient.queue.CommandQueue.MAX_PENDING_COMMANDS, com.realtime.crossfire.jxclient.queue.CommandQueue.pendingCommands, and com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.sendNcom().
boolean com.realtime.crossfire.jxclient.queue.CommandQueue.stopRunning | ( | ) |
Tells the server to stop running.
If the character is not running, does nothing.
Definition at line 228 of file CommandQueue.java.
References com.realtime.crossfire.jxclient.queue.CommandQueue.isRunning, com.realtime.crossfire.jxclient.queue.CommandQueue.pendingCommands, and com.realtime.crossfire.jxclient.queue.CommandQueue.sendNcom().
Referenced by com.realtime.crossfire.jxclient.window.KeyHandler.updateModifiers().
|
private |
The listener to track comc commands.
Definition at line 75 of file CommandQueue.java.
Referenced by com.realtime.crossfire.jxclient.queue.CommandQueue.CommandQueue().
|
private |
The server connection for sending ncom commands.
Definition at line 49 of file CommandQueue.java.
Referenced by com.realtime.crossfire.jxclient.queue.CommandQueue.CommandQueue(), com.realtime.crossfire.jxclient.queue.CommandQueue.sendMove(), and com.realtime.crossfire.jxclient.queue.CommandQueue.sendNcom().
|
private |
The GuiStateListener for detecting established or dropped connections.
Definition at line 98 of file CommandQueue.java.
Referenced by com.realtime.crossfire.jxclient.queue.CommandQueue.CommandQueue().
|
private |
Whether a "run" command has been sent without a following "run_stop" command.
Definition at line 68 of file CommandQueue.java.
Referenced by com.realtime.crossfire.jxclient.queue.CommandQueue.checkRun(), com.realtime.crossfire.jxclient.queue.CommandQueue.clear(), com.realtime.crossfire.jxclient.queue.CommandQueue.sendNcom(), and com.realtime.crossfire.jxclient.queue.CommandQueue.stopRunning().
|
staticprivate |
Maximum number of pending commands sent to the server.
Excess commands will be dropped.
Definition at line 43 of file CommandQueue.java.
Referenced by com.realtime.crossfire.jxclient.queue.CommandQueue.sendNcom().
|
private |
Records command ids of commands sent to the server for which no comc commands has been received.
Note that the size may be larger than MAX_PENDING_COMMANDS due to "must send" commands.
Definition at line 57 of file CommandQueue.java.
Referenced by com.realtime.crossfire.jxclient.queue.CommandQueue.checkRun(), com.realtime.crossfire.jxclient.queue.CommandQueue.clear(), com.realtime.crossfire.jxclient.queue.CommandQueue.sendNcom(), and com.realtime.crossfire.jxclient.queue.CommandQueue.stopRunning().
|
private |
The default repeat counter for ncom commands.
Definition at line 62 of file CommandQueue.java.
Referenced by com.realtime.crossfire.jxclient.queue.CommandQueue.addToRepeatCount(), com.realtime.crossfire.jxclient.queue.CommandQueue.getRepeatCount(), and com.realtime.crossfire.jxclient.queue.CommandQueue.resetRepeatCount().