src/network/core/tcp.h
branchgamebalance
changeset 9895 7bd07f43b0e3
parent 6447 3b71e57fd22b
equal deleted inserted replaced
9894:70d78ac95d6c 9895:7bd07f43b0e3
    56 	PACKET_CLIENT_NEWGRFS_CHECKED,
    56 	PACKET_CLIENT_NEWGRFS_CHECKED,
    57 	PACKET_END                   ///< Must ALWAYS be on the end of this list!! (period)
    57 	PACKET_END                   ///< Must ALWAYS be on the end of this list!! (period)
    58 };
    58 };
    59 
    59 
    60 /** Packet that wraps a command */
    60 /** Packet that wraps a command */
    61 typedef struct CommandPacket {
    61 struct CommandPacket {
    62 	struct CommandPacket *next; ///< the next command packet (if in queue)
    62 	CommandPacket *next; ///< the next command packet (if in queue)
    63 	PlayerByte player; ///< player that is executing the command
    63 	PlayerByte player; ///< player that is executing the command
    64 	uint32 cmd;        ///< command being executed
    64 	uint32 cmd;        ///< command being executed
    65 	uint32 p1;         ///< parameter p1
    65 	uint32 p1;         ///< parameter p1
    66 	uint32 p2;         ///< parameter p2
    66 	uint32 p2;         ///< parameter p2
    67 	TileIndex tile;    ///< tile command being executed on
    67 	TileIndex tile;    ///< tile command being executed on
    68 	char text[80];     ///< possible text sent for name changes etc
    68 	char text[80];     ///< possible text sent for name changes etc
    69 	uint32 frame;      ///< the frame in which this packet is executed
    69 	uint32 frame;      ///< the frame in which this packet is executed
    70 	byte callback;     ///< any callback function executed upon successful completion of the command
    70 	byte callback;     ///< any callback function executed upon successful completion of the command
    71 } CommandPacket;
    71 };
    72 
    72 
    73 /** Status of a client */
    73 /** Status of a client */
    74 typedef enum {
    74 enum ClientStatus {
    75 	STATUS_INACTIVE,   ///< The client is not connected nor active
    75 	STATUS_INACTIVE,   ///< The client is not connected nor active
       
    76 	STATUS_AUTHORIZING,///< The client is authorizing
    76 	STATUS_AUTH,       ///< The client is authorized
    77 	STATUS_AUTH,       ///< The client is authorized
    77 	STATUS_MAP_WAIT,   ///< The client is waiting as someone else is downloading the map
    78 	STATUS_MAP_WAIT,   ///< The client is waiting as someone else is downloading the map
    78 	STATUS_MAP,        ///< The client is downloading the map
    79 	STATUS_MAP,        ///< The client is downloading the map
    79 	STATUS_DONE_MAP,   ///< The client has downloaded the map
    80 	STATUS_DONE_MAP,   ///< The client has downloaded the map
    80 	STATUS_PRE_ACTIVE, ///< The client is catching up the delayed frames
    81 	STATUS_PRE_ACTIVE, ///< The client is catching up the delayed frames
    81 	STATUS_ACTIVE,     ///< The client is an active player in the game
    82 	STATUS_ACTIVE,     ///< The client is an active player in the game
    82 } ClientStatus;
    83 };
    83 
    84 
    84 /** Base socket handler for all TCP sockets */
    85 /** Base socket handler for all TCP sockets */
    85 class NetworkTCPSocketHandler : public NetworkSocketHandler {
    86 class NetworkTCPSocketHandler : public NetworkSocketHandler {
    86 /* TODO: rewrite into a proper class */
    87 /* TODO: rewrite into a proper class */
    87 private:
    88 private: