diff options
author | rubidium <rubidium@openttd.org> | 2010-10-18 20:41:53 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-10-18 20:41:53 +0000 |
commit | d71f590ed6cf39f1f21384ce480c5b70cbf3ec41 (patch) | |
tree | 004060f9b4ae89b461287d62b5895528d895260e /src | |
parent | 9a0a76cc32ab47bdf229b0f6957e8edd8d3eccf1 (diff) | |
download | openttd-d71f590ed6cf39f1f21384ce480c5b70cbf3ec41.tar.xz |
(svn r20993) -Codechange: some shuffling of game protocol packet description so they're documented in the "same" place as UDP, content and admin packets (dihedral)
Diffstat (limited to 'src')
-rw-r--r-- | src/network/core/tcp_game.h | 262 | ||||
-rw-r--r-- | src/network/network_client.cpp | 105 | ||||
-rw-r--r-- | src/network/network_server.cpp | 158 |
3 files changed, 262 insertions, 263 deletions
diff --git a/src/network/core/tcp_game.h b/src/network/core/tcp_game.h index 2a24b938c..3cd7b442e 100644 --- a/src/network/core/tcp_game.h +++ b/src/network/core/tcp_game.h @@ -118,45 +118,307 @@ private: NetworkClientInfo *info; ///< Client info related to this socket protected: + + /** + * Notification that the server is full. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_FULL); + + /** + * Notification that the client trying to join is banned. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_BANNED); + + /** + * Try to join the server: + * string OpenTTD revision (norev000 if no revision). + * string Name of the client (max NETWORK_NAME_LENGTH). + * uint8 ID of the company to play as (1..MAX_COMPANIES). + * uint8 ID of the clients Language. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_JOIN); + + /** + * The client made an error: + * uint8 Error code caused (see NetworkErrorCode). + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_ERROR); + + /** + * Request company information (in detail). + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_COMPANY_INFO); + + /** + * Sends information about the companies (one packet per company): + * uint8 Version of the structure of this packet (NETWORK_COMPANY_INFO_VERSION). + * bool Contains data (false marks the end of updates). + * uint8 ID of the company. + * string Name of the company. + * uint32 Year the company was inaugurated. + * uint64 Value. + * uint64 Money. + * uint64 Income. + * uint16 Performance (last quarter). + * bool Company is password protected. + * uint16 Number of trains. + * uint16 Number of lorries. + * uint16 Number of busses. + * uint16 Number of planes. + * uint16 Number of ships. + * uint16 Number of train stations. + * uint16 Number of lorry stations. + * uint16 Number of bus stops. + * uint16 Number of airports and heliports. + * uint16 Number of harbours. + * bool Company is an AI. + * string Client names (comma separated list) + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_INFO); + + /** + * Send information about a client: + * uint32 ID of the client (always unique on a server. 1 = server, 0 is invalid). + * uint8 ID of the company the client is playing as (255 for spectators). + * string Name of the client. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO); + + /** + * Indication to the client that the server needs a game password. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_NEED_GAME_PASSWORD); + + /** + * Indication to the client that the server needs a company password: + * uint32 Generation seed. + * string Network ID of the server. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_NEED_COMPANY_PASSWORD); + + /** + * Send a password to the server to authorize: + * uint8 Password type (see NetworkPasswordType). + * string The password. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_GAME_PASSWORD); + + /** + * Send a password to the server to authorize + * uint8 Password type (see NetworkPasswordType). + * string The password. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_COMPANY_PASSWORD); + + /** + * The client is joined and ready to receive his map: + * uint32 Own client ID. + * uint32 Generation seed. + * string Network ID of the server. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_WELCOME); + + /** + * Request the map from the server. + * uint32 NewGRF version (release versions of OpenTTD only). + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_GETMAP); + + /** + * Notification that another client is currently receiving the map: + * uint8 Number of clients awaiting the map. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_WAIT); + + /** + * Sends parts of the map to the client: + * uint8 packet type (MAP_PACKET_START, MAP_PACKET_NORMAL, MAP_PACKET_END). + * If MAP_PACKET_START: + * uint32 Current frame. + * uint32 Size of the map (in bytes). + * If MAP_PACKET_NORMAL: + * Part of the map (until max size of packet). + * If MAP_PACKET_END: + * No further data sent. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MAP); + + /** + * Tell the server that we are done receiving/loading the map. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_MAP_OK); + + /** + * A client joined (PACKET_CLIENT_MAP_OK), what usually directly follows is a PACKET_SERVER_CLIENT_INFO: + * uint32 ID of the client that just joined the game. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_JOIN); + + /** + * Sends the current frame counter to the client: + * uint32 Frame counter + * uint32 Frame counter max (how far may the client walk before the server?) + * uint32 General seed 1 (dependant on compile settings, not default). + * uint32 General seed 2 (dependant on compile settings, not default). + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_FRAME); + + /** + * Sends a sync-check to the client: + * uint32 Frame counter. + * uint32 General seed 1. + * uint32 General seed 2 (dependant on compile settings, not default). + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_SYNC); + + /** + * Tell the server we are done with this frame: + * uint32 Current frame counter of the client. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_ACK); + + /** + * Send a DoCommand to the Server: + * uint8 ID of the company (0..MAX_COMPANIES-1). + * uint32 ID of the command (see command.h). + * uint32 P1 (free variables used in DoCommand). + * uint32 P2 + * uint32 Tile where this is taking place. + * string Text. + * uint8 ID of the callback. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND); + + /** + * Sends a DoCommand to the client: + * uint8 ID of the company (0..MAX_COMPANIES-1). + * uint32 ID of the command (see command.h). + * uint32 P1 (free variable used in DoCommand). + * uint32 P2. + * uint32 Tile where this is taking place. + * string Text. + * uint8 ID of the callback. + * uint32 Frame of execution. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_COMMAND); + + /** + * Sends a chat-packet to the server: + * uint8 ID of the action (see NetworkAction). + * uint8 ID of the destination type (see DestType). + * uint32 ID of the client or company (destination of the chat). + * string Message (max NETWORK_CHAT_LENGTH). + * uint64 data (used e.g. for 'give money' actions). + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_CHAT); + + /** + * Sends a chat-packet to the client: + * uint8 ID of the action (see NetworkAction). + * uint32 ID of the client (origin of the chat). + * string Message (max NETWORK_CHAT_LENGTH). + * uint64 data (used e.g. for 'give money' actions). + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_CHAT); + + /** + * Set the password for the clients current company: + * string The password. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_SET_PASSWORD); + + /** + * Gives the client a new name: + * string New name of the client. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_SET_NAME); + + /** + * The client is quiting the game. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_QUIT); + + /** + * The client made an error and is quiting the game. + * uint8 Error of the code caused (see NetworkErrorCode). + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_ERROR); + + /** + * Notification that a client left the game: + * uint32 ID of the client. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_QUIT); + + /** + * Inform all clients that one client made an error and thus has quit/been disconnected: + * uint32 ID of the client that caused the error. + * uint8 Code of the error caused (see NetworkErrorCode). + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_ERROR_QUIT); + + /** + * Let the clients know that the server is closing. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_SHUTDOWN); + + /** + * Let the clients know that the server is loading a new map. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_NEWGAME); + + /** + * Send the result of an issues RCon command back to the client: + * uint16 Colour code. + * string Output of the RCon command + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_RCON); + + /** + * Send an RCon command to the server: + * string RCon password. + * string Command to be executed. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_RCON); + + /** + * Sends information about all used GRFs to the client: + * uint8 Amount of GRFs (the following data is repeated this many times, i.e. per GRF data). + * uint32 GRF ID + * 16 * uint8 MD5 checksum of the GRF + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_CHECK_NEWGRFS); + + /** + * Tell the server that we have the required GRFs + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_NEWGRFS_CHECKED); + + /** + * Move a client from one company into another: + * uint32 ID of the client. + * uint8 ID of the new company. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MOVE); + + /** + * Request the server to move this client into another company: + * uint8 ID of the company the client wants to join. + * string Password, if the company is password protected. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_MOVE); + + /** + * Update the clients knowledge of which company is password protected: + * uint16 Bitwise representation of each company + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_UPDATE); + + /** + * Update the clients knowledge of the max settings: + * uint8 Maximum number of companies allowed. + * uint8 Maximum number of spectators allowed. + */ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_CONFIG_UPDATE); NetworkRecvStatus HandlePacket(Packet *p); diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index d157ebe7c..7cb76366b 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -266,12 +266,6 @@ void HashCurrentCompanyPassword(const char *password) NetworkRecvStatus ClientNetworkGameSocketHandler::SendCompanyInformationQuery() { - /* - * Packet: CLIENT_COMPANY_INFO - * Function: Request company-info (in detail) - * Data: - * <none> - */ Packet *p; _network_join_status = NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO; SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0); @@ -283,16 +277,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendCompanyInformationQuery() NetworkRecvStatus ClientNetworkGameSocketHandler::SendJoin() { - /* - * Packet: CLIENT_JOIN - * Function: Try to join the server - * Data: - * String: OpenTTD Revision (norev000 if no revision) - * String: Client Name (max NETWORK_NAME_LENGTH) - * uint8: Play as Company id (1..MAX_COMPANIES) - * uint8: Language ID - */ - Packet *p; _network_join_status = NETWORK_JOIN_STATUS_AUTHORIZING; SetWindowDirty(WC_NETWORK_STATUS_WINDOW, 0); @@ -308,12 +292,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendJoin() NetworkRecvStatus ClientNetworkGameSocketHandler::SendNewGRFsOk() { - /* - * Packet: CLIENT_NEWGRFS_CHECKED - * Function: Tell the server that we have the required GRFs - * Data: - */ - Packet *p = new Packet(PACKET_CLIENT_NEWGRFS_CHECKED); my_client->Send_Packet(p); return NETWORK_RECV_STATUS_OKAY; @@ -321,13 +299,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendNewGRFsOk() NetworkRecvStatus ClientNetworkGameSocketHandler::SendGamePassword(const char *password) { - /* - * Packet: CLIENT_GAME_PASSWORD - * Function: Send a password to the server to authorize - * Data: - * uint8: NetworkPasswordType - * String: Password - */ Packet *p = new Packet(PACKET_CLIENT_GAME_PASSWORD); p->Send_string(password); my_client->Send_Packet(p); @@ -336,13 +307,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendGamePassword(const char *p NetworkRecvStatus ClientNetworkGameSocketHandler::SendCompanyPassword(const char *password) { - /* - * Packet: CLIENT_COMPANY_PASSWORD - * Function: Send a password to the server to authorize - * Data: - * uint8: NetworkPasswordType - * String: Password - */ Packet *p = new Packet(PACKET_CLIENT_COMPANY_PASSWORD); p->Send_string(GenerateCompanyPasswordHash(password)); my_client->Send_Packet(p); @@ -351,13 +315,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendCompanyPassword(const char NetworkRecvStatus ClientNetworkGameSocketHandler::SendGetMap() { - /* - * Packet: CLIENT_GETMAP - * Function: Request the map from the server - * Data: - * <none> - */ - Packet *p = new Packet(PACKET_CLIENT_GETMAP); /* Send the OpenTTD version to the server, let it validate it too. * But only do it for stable releases because of those we are sure @@ -372,13 +329,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendGetMap() NetworkRecvStatus ClientNetworkGameSocketHandler::SendMapOk() { - /* - * Packet: CLIENT_MAP_OK - * Function: Tell the server that we are done receiving/loading the map - * Data: - * <none> - */ - Packet *p = new Packet(PACKET_CLIENT_MAP_OK); my_client->Send_Packet(p); return NETWORK_RECV_STATUS_OKAY; @@ -386,13 +336,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendMapOk() NetworkRecvStatus ClientNetworkGameSocketHandler::SendAck() { - /* - * Packet: CLIENT_ACK - * Function: Tell the server we are done with this frame - * Data: - * uint32: current FrameCounter of the client - */ - Packet *p = new Packet(PACKET_CLIENT_ACK); p->Send_uint32(_frame_counter); @@ -403,19 +346,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendAck() /* Send a command packet to the server */ NetworkRecvStatus ClientNetworkGameSocketHandler::SendCommand(const CommandPacket *cp) { - /* - * Packet: CLIENT_COMMAND - * Function: Send a DoCommand to the Server - * Data: - * uint8: CompanyID (0..MAX_COMPANIES-1) - * uint32: CommandID (see command.h) - * uint32: P1 (free variables used in DoCommand) - * uint32: P2 - * uint32: Tile - * string: text - * uint8: CallBackID - */ - Packet *p = new Packet(PACKET_CLIENT_COMMAND); my_client->Send_Command(p, cp); @@ -426,17 +356,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendCommand(const CommandPacke /* Send a chat-packet over the network */ NetworkRecvStatus ClientNetworkGameSocketHandler::SendChat(NetworkAction action, DestType type, int dest, const char *msg, int64 data) { - /* - * Packet: CLIENT_CHAT - * Function: Send a chat-packet to the serve - * Data: - * uint8: ActionID (see network_data.h, NetworkAction) - * uint8: Destination Type (see network_data.h, DestType); - * uint32: Destination CompanyID/Client-identifier - * String: Message (max NETWORK_CHAT_LENGTH) - * uint64: Some arbitrary number - */ - Packet *p = new Packet(PACKET_CLIENT_CHAT); p->Send_uint8 (action); @@ -452,12 +371,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendChat(NetworkAction action, /* Send an error-packet over the network */ NetworkRecvStatus ClientNetworkGameSocketHandler::SendError(NetworkErrorCode errorno) { - /* - * Packet: CLIENT_ERROR - * Function: The client made an error and is quiting the game - * Data: - * uint8: ErrorID (see network_data.h, NetworkErrorCode) - */ Packet *p = new Packet(PACKET_CLIENT_ERROR); p->Send_uint8(errorno); @@ -467,12 +380,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendError(NetworkErrorCode err NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetPassword(const char *password) { - /* - * Packet: PACKET_CLIENT_SET_PASSWORD - * Function: Set the password for the clients current company - * Data: - * String: Password - */ Packet *p = new Packet(PACKET_CLIENT_SET_PASSWORD); p->Send_string(GenerateCompanyPasswordHash(password)); @@ -482,12 +389,6 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetPassword(const char *pa NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetName(const char *name) { - /* - * Packet: PACKET_CLIENT_SET_NAME - * Function: Gives the client a new name - * Data: - * String: Name - */ Packet *p = new Packet(PACKET_CLIENT_SET_NAME); p->Send_string(name); @@ -495,14 +396,8 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::SendSetName(const char *name) return NETWORK_RECV_STATUS_OKAY; } -/* Send an quit-packet over the network */ NetworkRecvStatus ClientNetworkGameSocketHandler::SendQuit() { - /* - * Packet: CLIENT_QUIT - * Function: The client is quiting the game - * Data: - */ Packet *p = new Packet(PACKET_CLIENT_QUIT); my_client->Send_Packet(p); diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 16b626ce5..94c829fe5 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -157,15 +157,6 @@ static void NetworkHandleCommandQueue(NetworkClientSocket *cs); NetworkRecvStatus ServerNetworkGameSocketHandler::SendClientInfo(NetworkClientInfo *ci) { - /* - * Packet: SERVER_CLIENT_INFO - * Function: Sends info about a client - * Data: - * uint32: The identifier of the client (always unique on a server. 1 = server, 0 is invalid) - * uint8: As which company the client is playing - * String: The name of the client - */ - if (ci->client_id != INVALID_CLIENT_ID) { Packet *p = new Packet(PACKET_SERVER_CLIENT_INFO); p->Send_uint32(ci->client_id); @@ -179,12 +170,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendClientInfo(NetworkClientIn NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyInfo() { - /* - * Packet: SERVER_COMPANY_INFO - * Function: Sends info about the companies - * Data: - */ - /* Fetch the latest version of the stats */ NetworkCompanyStats company_stats[MAX_COMPANIES]; NetworkPopulateCompanyStats(company_stats); @@ -247,13 +232,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendCompanyInfo() NetworkRecvStatus ServerNetworkGameSocketHandler::SendError(NetworkErrorCode error) { - /* - * Packet: SERVER_ERROR - * Function: The client made an error - * Data: - * uint8: ErrorID (see network_data.h, NetworkErrorCode) - */ - char str[100]; Packet *p = new Packet(PACKET_SERVER_ERROR); @@ -296,16 +274,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendError(NetworkErrorCode err NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGRFCheck() { - /* - * Packet: PACKET_SERVER_CHECK_NEWGRFS - * Function: Sends info about the used GRFs to the client - * Data: - * uint8: Amount of GRFs - * And then for each GRF: - * uint32: GRF ID - * 16 * uint8: MD5 checksum of the GRF - */ - Packet *p = new Packet(PACKET_SERVER_CHECK_NEWGRFS); const GRFConfig *c; uint grf_count = 0; @@ -325,11 +293,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGRFCheck() NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedGamePassword() { - /* - * Packet: PACKET_SERVER_NEED_GAME_PASSWORD - * Function: Indication to the client that the server needs a game password - */ - /* Invalid packet when status is STATUS_AUTH_GAME or higher */ if (this->status >= STATUS_AUTH_GAME) return this->CloseConnection(NETWORK_RECV_STATUS_MALFORMED_PACKET); @@ -342,14 +305,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedGamePassword() NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedCompanyPassword() { - /* - * Packet: PACKET_SERVER_NEED_COMPANY_PASSWORD - * Function: Indication to the client that the server needs a company password - * Data: - * uint32: Generation seed - * string: Network ID of the server - */ - /* Invalid packet when status is STATUS_AUTH_COMPANY or higher */ if (this->status >= STATUS_AUTH_COMPANY) return this->CloseConnection(NETWORK_RECV_STATUS_MALFORMED_PACKET); @@ -364,13 +319,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendNeedCompanyPassword() NetworkRecvStatus ServerNetworkGameSocketHandler::SendWelcome() { - /* - * Packet: SERVER_WELCOME - * Function: The client is joined and ready to receive his map - * Data: - * uint32: Own Client identifier - */ - Packet *p; NetworkClientSocket *new_cs; @@ -398,13 +346,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendWelcome() NetworkRecvStatus ServerNetworkGameSocketHandler::SendWait() { - /* - * Packet: PACKET_SERVER_WAIT - * Function: The client can not receive the map at the moment because - * someone else is already receiving the map - * Data: - * uint8: Clients awaiting map - */ int waiting = 0; NetworkClientSocket *new_cs; Packet *p; @@ -423,20 +364,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendWait() /* This sends the map to the client */ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap() { - /* - * Packet: SERVER_MAP - * Function: Sends the map to the client, or a part of it (it is splitted in - * a lot of multiple packets) - * Data: - * uint8: packet-type (MAP_PACKET_START, MAP_PACKET_NORMAL and MAP_PACKET_END) - * if MAP_PACKET_START: - * uint32: The current FrameCounter - * if MAP_PACKET_NORMAL: - * piece of the map (till max-size of packet) - * if MAP_PACKET_END: - * nothing - */ - static FILE *file_pointer = NULL; static uint sent_packets; // How many packets we did send succecfully last time @@ -541,15 +468,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendMap() NetworkRecvStatus ServerNetworkGameSocketHandler::SendJoin(ClientID client_id) { - /* - * Packet: SERVER_JOIN - * Function: A client is joined (all active clients receive this after a - * PACKET_CLIENT_MAP_OK) Mostly what directly follows is a - * PACKET_SERVER_CLIENT_INFO - * Data: - * uint32: Client-identifier - */ - Packet *p = new Packet(PACKET_SERVER_JOIN); p->Send_uint32(client_id); @@ -561,17 +479,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendJoin(ClientID client_id) NetworkRecvStatus ServerNetworkGameSocketHandler::SendFrame() { - /* - * Packet: SERVER_FRAME - * Function: Sends the current frame-counter to the client - * Data: - * uint32: Frame Counter - * uint32: Frame Counter Max (how far may the client walk before the server?) - * [uint32: general-seed-1] - * [uint32: general-seed-2] - * (last two depends on compile-settings, and are not default settings) - */ - Packet *p = new Packet(PACKET_SERVER_FRAME); p->Send_uint32(_frame_counter); p->Send_uint32(_frame_counter_max); @@ -587,16 +494,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendFrame() NetworkRecvStatus ServerNetworkGameSocketHandler::SendSync() { - /* - * Packet: SERVER_SYNC - * Function: Sends a sync-check to the client - * Data: - * uint32: Frame Counter - * uint32: General-seed-1 - * [uint32: general-seed-2] - * (last one depends on compile-settings, and are not default settings) - */ - Packet *p = new Packet(PACKET_SERVER_SYNC); p->Send_uint32(_frame_counter); p->Send_uint32(_sync_seed_1); @@ -610,20 +507,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendSync() NetworkRecvStatus ServerNetworkGameSocketHandler::SendCommand(const CommandPacket *cp) { - /* - * Packet: SERVER_COMMAND - * Function: Sends a DoCommand to the client - * Data: - * uint8: CompanyID (0..MAX_COMPANIES-1) - * uint32: CommandID (see command.h) - * uint32: P1 (free variables used in DoCommand) - * uint32: P2 - * uint32: Tile - * string: text - * uint8: CallBackID - * uint32: Frame of execution - */ - Packet *p = new Packet(PACKET_SERVER_COMMAND); this->Send_Command(p, cp); @@ -636,16 +519,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendCommand(const CommandPacke NetworkRecvStatus ServerNetworkGameSocketHandler::SendChat(NetworkAction action, ClientID client_id, bool self_send, const char *msg, int64 data) { - /* - * Packet: SERVER_CHAT - * Function: Sends a chat-packet to the client - * Data: - * uint8: ActionID (see network_data.h, NetworkAction) - * uint32: Client-identifier - * String: Message (max NETWORK_CHAT_LENGTH) - * uint64: Arbitrary data - */ - Packet *p = new Packet(PACKET_SERVER_CHAT); p->Send_uint8 (action); @@ -660,15 +533,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendChat(NetworkAction action, NetworkRecvStatus ServerNetworkGameSocketHandler::SendErrorQuit(ClientID client_id, NetworkErrorCode errorno) { - /* - * Packet: SERVER_ERROR_QUIT - * Function: One of the clients made an error and is quiting the game - * This packet informs the other clients of that. - * Data: - * uint32: Client-identifier - * uint8: ErrorID (see network_data.h, NetworkErrorCode) - */ - Packet *p = new Packet(PACKET_SERVER_ERROR_QUIT); p->Send_uint32(client_id); @@ -680,14 +544,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendErrorQuit(ClientID client_ NetworkRecvStatus ServerNetworkGameSocketHandler::SendQuit(ClientID client_id) { - /* - * Packet: SERVER_ERROR_QUIT - * Function: A client left the game, and this packets informs the other clients - * of that. - * Data: - * uint32: Client-identifier - */ - Packet *p = new Packet(PACKET_SERVER_QUIT); p->Send_uint32(client_id); @@ -698,13 +554,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendQuit(ClientID client_id) NetworkRecvStatus ServerNetworkGameSocketHandler::SendShutdown() { - /* - * Packet: SERVER_SHUTDOWN - * Function: Let the clients know that the server is closing - * Data: - * <none> - */ - Packet *p = new Packet(PACKET_SERVER_SHUTDOWN); this->Send_Packet(p); return NETWORK_RECV_STATUS_OKAY; @@ -712,13 +561,6 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendShutdown() NetworkRecvStatus ServerNetworkGameSocketHandler::SendNewGame() { - /* - * Packet: PACKET_SERVER_NEWGAME - * Function: Let the clients know that the server is loading a new map - * Data: - * <none> - */ - Packet *p = new Packet(PACKET_SERVER_NEWGAME); this->Send_Packet(p); return NETWORK_RECV_STATUS_OKAY; |