|
OpenTTD Source
1.10.0-RC1
|
Command handling over network connections. More...
#include "../stdafx.h"#include "network_admin.h"#include "network_client.h"#include "network_server.h"#include "../command_func.h"#include "../company_func.h"#include "../settings_type.h"#include "../safeguards.h"Go to the source code of this file.
Functions | |
| void | NetworkSendCommand (TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback, const char *text, CompanyID company) |
| Prepare a DoCommand to be send over the network. More... | |
| void | NetworkSyncCommandQueue (NetworkClientSocket *cs) |
| Sync our local command queue to the command queue of the given socket. More... | |
| void | NetworkExecuteLocalCommandQueue () |
| Execute all commands on the local command queue that ought to be executed this frame. | |
| void | NetworkFreeLocalCommandQueue () |
| Free the local command queues. | |
| static void | DistributeCommandPacket (CommandPacket &cp, const NetworkClientSocket *owner) |
| "Send" a particular CommandPacket to all clients. More... | |
| static void | DistributeQueue (CommandQueue *queue, const NetworkClientSocket *owner) |
| "Send" a particular CommandQueue to all clients. More... | |
| void | NetworkDistributeCommands () |
| Distribute the commands of ourself and the clients. More... | |
Variables | |
| static CommandCallback *const | _callback_table [] |
| Table with all the callbacks we'll use for conversion. More... | |
| static CommandQueue | _local_wait_queue |
| Local queue of packets waiting for handling. More... | |
| static CommandQueue | _local_execution_queue |
| Local queue of packets waiting for execution. More... | |
Command handling over network connections.
Definition in file network_command.cpp.
|
static |
"Send" a particular CommandPacket to all clients.
| cp | The command that has to be distributed. |
| owner | The client that owns the command, |
Definition at line 236 of file network_command.cpp.
References _frame_counter_max, CommandQueue::Append(), CommandContainer::callback, CommandPacket::frame, and CommandPacket::my_cmd.
|
static |
"Send" a particular CommandQueue to all clients.
| queue | The queue of commands that has to be distributed. |
| owner | The client that owns the commands, |
Definition at line 261 of file network_command.cpp.
Referenced by NetworkDistributeCommands().
| void NetworkDistributeCommands | ( | ) |
Distribute the commands of ourself and the clients.
Definition at line 279 of file network_command.cpp.
References DistributeQueue().
| void NetworkSendCommand | ( | TileIndex | tile, |
| uint32 | p1, | ||
| uint32 | p2, | ||
| uint32 | cmd, | ||
| CommandCallback * | callback, | ||
| const char * | text, | ||
| CompanyID | company | ||
| ) |
Prepare a DoCommand to be send over the network.
| tile | The tile to perform a command on (see CommandProc) |
| p1 | Additional data for the command (see CommandProc) |
| p2 | Additional data for the command (see CommandProc) |
| cmd | The command to execute (a CMD_* value) |
| callback | A callback function to call after the command is finished |
| text | The text to pass |
| company | The company that wants to send the command |
Definition at line 136 of file network_command.cpp.
| void NetworkSyncCommandQueue | ( | NetworkClientSocket * | cs | ) |
Sync our local command queue to the command queue of the given socket.
This is needed for the case where we receive a command before saving the game for a joining client, but without the execution of those commands. Not syncing those commands means that the client will never get them and as such will be in a desynced state from the time it started with joining.
| cs | The client to sync the queue to. |
Definition at line 179 of file network_command.cpp.
References CommandContainer::callback, CommandPacket::next, and CommandQueue::Peek().
|
static |
Table with all the callbacks we'll use for conversion.
Definition at line 21 of file network_command.cpp.
Referenced by NetworkGameSocketHandler::SendCommand().
|
static |
Local queue of packets waiting for execution.
Definition at line 124 of file network_command.cpp.
|
static |
Local queue of packets waiting for handling.
Definition at line 122 of file network_command.cpp.