18 #define NETWORK_SERVER_INDEX 1 |
18 #define NETWORK_SERVER_INDEX 1 |
19 #define NETWORK_EMPTY_INDEX 0 |
19 #define NETWORK_EMPTY_INDEX 0 |
20 |
20 |
21 typedef struct CommandPacket { |
21 typedef struct CommandPacket { |
22 struct CommandPacket *next; |
22 struct CommandPacket *next; |
23 PlayerID player; /// player that is executing the command |
23 PlayerByte player; /// player that is executing the command |
24 uint32 cmd; /// command being executed |
24 uint32 cmd; /// command being executed |
25 uint32 p1; /// parameter p1 |
25 uint32 p1; /// parameter p1 |
26 uint32 p2; /// parameter p2 |
26 uint32 p2; /// parameter p2 |
27 TileIndex tile; /// tile command being executed on |
27 TileIndex tile; /// tile command being executed on |
28 char text[80]; |
28 char text[80]; |
118 DESTTYPE_BROADCAST, ///< Send message/notice to all players (All) |
118 DESTTYPE_BROADCAST, ///< Send message/notice to all players (All) |
119 DESTTYPE_TEAM, ///< Send message/notice to everyone playing the same company (Team) |
119 DESTTYPE_TEAM, ///< Send message/notice to everyone playing the same company (Team) |
120 DESTTYPE_CLIENT, ///< Send message/notice to only a certain player (Private) |
120 DESTTYPE_CLIENT, ///< Send message/notice to only a certain player (Private) |
121 } DestType; |
121 } DestType; |
122 |
122 |
123 CommandPacket *_local_command_queue; |
123 // following externs are instantiated at network.cpp |
|
124 extern CommandPacket *_local_command_queue; |
124 |
125 |
125 SOCKET _udp_client_socket; // udp client socket |
126 extern SOCKET _udp_client_socket; // udp client socket |
126 SOCKET _udp_server_socket; // udp server socket |
127 extern SOCKET _udp_server_socket; // udp server socket |
127 SOCKET _udp_master_socket; // udp master socket |
128 extern SOCKET _udp_master_socket; // udp master socket |
128 |
129 |
129 // Here we keep track of the clients |
130 // Here we keep track of the clients |
130 // (and the client uses [0] for his own communication) |
131 // (and the client uses [0] for his own communication) |
131 NetworkClientState _clients[MAX_CLIENTS]; |
132 extern NetworkClientState _clients[MAX_CLIENTS]; |
|
133 |
132 #define DEREF_CLIENT(i) (&_clients[i]) |
134 #define DEREF_CLIENT(i) (&_clients[i]) |
133 // This returns the NetworkClientInfo from a NetworkClientState |
135 // This returns the NetworkClientInfo from a NetworkClientState |
134 #define DEREF_CLIENT_INFO(cs) (&_network_client_info[cs - _clients]) |
136 #define DEREF_CLIENT_INFO(cs) (&_network_client_info[cs - _clients]) |
135 |
137 |
136 // Macros to make life a bit more easier |
138 // Macros to make life a bit more easier |