8 #include "network_client.h" |
8 #include "network_client.h" |
9 #include "../command_func.h" |
9 #include "../command_func.h" |
10 #include "../callback_table.h" |
10 #include "../callback_table.h" |
11 #include "../core/alloc_func.hpp" |
11 #include "../core/alloc_func.hpp" |
12 #include "../string_func.h" |
12 #include "../string_func.h" |
|
13 #include "../date_func.h" |
|
14 #include "../player_func.h" |
13 |
15 |
14 // Add a command to the local command queue |
16 // Add a command to the local command queue |
15 void NetworkAddCommandQueue(NetworkTCPSocketHandler *cs, CommandPacket *cp) |
17 void NetworkAddCommandQueue(NetworkTCPSocketHandler *cs, CommandPacket *cp) |
16 { |
18 { |
17 CommandPacket* new_cp = MallocT<CommandPacket>(1); |
19 CommandPacket* new_cp = MallocT<CommandPacket>(1); |
97 if (cp->callback > _callback_table_count) { |
99 if (cp->callback > _callback_table_count) { |
98 DEBUG(net, 0, "Received out-of-bounds callback (%d)", cp->callback); |
100 DEBUG(net, 0, "Received out-of-bounds callback (%d)", cp->callback); |
99 cp->callback = 0; |
101 cp->callback = 0; |
100 } |
102 } |
101 |
103 |
102 #ifdef DEBUG_DUMP_COMMANDS |
104 DebugDumpCommands("ddc:cmd:%d;%d;%d;%d;%d;%d;%d;%s\n", _date, _date_fract, (int)cp->player, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text); |
103 extern Date _date; |
|
104 extern DateFract _date_fract; |
|
105 debug_dump_commands("ddc:cmd:%d;%d;%d;%d;%d;%d;%d;%s\n", _date, _date_fract, (int)cp->player, cp->tile, cp->p1, cp->p2, cp->cmd, cp->text); |
|
106 #endif /* DUMP_COMMANDS */ |
|
107 |
105 |
108 DoCommandP(cp->tile, cp->p1, cp->p2, _callback_table[cp->callback], cp->cmd | CMD_NETWORK_COMMAND, cp->my_cmd); |
106 DoCommandP(cp->tile, cp->p1, cp->p2, _callback_table[cp->callback], cp->cmd | CMD_NETWORK_COMMAND, cp->my_cmd); |
109 } |
107 } |
110 |
108 |
111 #endif /* ENABLE_NETWORK */ |
109 #endif /* ENABLE_NETWORK */ |