summaryrefslogtreecommitdiff
path: root/src/network/network_server.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-18 22:40:17 +0000
committerrubidium <rubidium@openttd.org>2010-08-18 22:40:17 +0000
commitb594990071fd6cff1c530c2fb4139c9aaaba6e08 (patch)
tree01563bf17bc91735880f25f66f91732cd5171f22 /src/network/network_server.cpp
parente8e22c99fd5cfccf6087632b46664fbd02f7900c (diff)
downloadopenttd-b594990071fd6cff1c530c2fb4139c9aaaba6e08.tar.xz
(svn r20549) -Codechange: centralise the handling of the incoming commands (from clients and the server)
Diffstat (limited to 'src/network/network_server.cpp')
-rw-r--r--src/network/network_server.cpp25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index e9cb791d5..dc7d9d0f6 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -891,8 +891,6 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_MAP_OK)
*/
DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
{
- NetworkClientSocket *new_cs;
-
/* The client was never joined.. so this is impossible, right?
* Ignore the packet, give the client a warning, and close his connection */
if (cs->status < STATUS_DONE_MAP || cs->HasClientQuit()) {
@@ -947,28 +945,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
if (GetCommandFlags(cp.cmd) & CMD_CLIENT_ID) cp.p2 = cs->client_id;
- /* The frame can be executed in the same frame as the next frame-packet
- * That frame just before that frame is saved in _frame_counter_max */
- cp.frame = _frame_counter_max + 1;
- cp.next = NULL;
-
- CommandCallback *callback = cp.callback;
-
- /* Queue the command for the clients (are send at the end of the frame
- * if they can handle it ;)) */
- FOR_ALL_CLIENT_SOCKETS(new_cs) {
- if (new_cs->status >= STATUS_MAP) {
- /* Callbacks are only send back to the client who sent them in the
- * first place. This filters that out. */
- cp.callback = (new_cs != cs) ? NULL : callback;
- cp.my_cmd = (new_cs == cs);
- NetworkAddCommandQueue(cp, new_cs);
- }
- }
-
- cp.callback = NULL;
- cp.my_cmd = false;
- NetworkAddCommandQueue(cp);
+ cs->incoming_queue.Append(&cp);
return NETWORK_RECV_STATUS_OKAY;
}