1 | /* |
1 | /* |
2 | * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team |
4 | * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002-2003,2007 Mark Wedel & The Crossfire Development Team |
5 | * Copyright (©) 2002-2003,2007 Mark Wedel & The Crossfire Development Team |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
6 | * Copyright (©) 1992,2007 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Crossfire TRT is free software: you can redistribute it and/or modify |
8 | * Deliantra is free software: you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation, either version 3 of the License, or |
10 | * the Free Software Foundation, either version 3 of the License, or |
11 | * (at your option) any later version. |
11 | * (at your option) any later version. |
12 | * |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
13 | * This program is distributed in the hope that it will be useful, |
… | |
… | |
16 | * GNU General Public License for more details. |
16 | * GNU General Public License for more details. |
17 | * |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | * |
20 | * |
21 | * The authors can be reached via e-mail to <crossfire@schmorp.de> |
21 | * The authors can be reached via e-mail to <support@deliantra.net> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | /** |
24 | /** |
25 | * \file |
25 | * \file |
26 | * Main client/server loops. |
26 | * Main client/server loops. |
… | |
… | |
75 | reset_state (); |
75 | reset_state (); |
76 | send_packet_printf ("drawinfo %d command queue overflow, ignoring.", NDI_RED); |
76 | send_packet_printf ("drawinfo %d command queue overflow, ignoring.", NDI_RED); |
77 | } |
77 | } |
78 | else |
78 | else |
79 | { |
79 | { |
80 | cmd_queue.push_back (command ()); |
80 | cmd_queue.resize (cmd_queue.size () + 1); |
81 | command &cmd = cmd_queue.back (); |
81 | command &cmd = cmd_queue.back (); |
82 | cmd.stamp = stamp; |
82 | cmd.stamp = stamp; |
83 | cmd.handler = handler; |
83 | cmd.handler = handler; |
84 | cmd.data = salloc<char> (datalen + 1, data); |
84 | cmd.data = salloc<char> (datalen + 1, data); |
85 | cmd.datalen = datalen; |
85 | cmd.datalen = datalen; |
… | |
… | |
101 | send_packet_printf ("drawinfo %d ignoring delayed commands.", NDI_RED); |
101 | send_packet_printf ("drawinfo %d ignoring delayed commands.", NDI_RED); |
102 | } |
102 | } |
103 | else |
103 | else |
104 | execute (cmd.handler, cmd.data, cmd.datalen); |
104 | execute (cmd.handler, cmd.data, cmd.datalen); |
105 | |
105 | |
|
|
106 | sfree<char> (cmd.data, cmd.datalen + 1); |
106 | cmd_queue.pop_front (); |
107 | cmd_queue.pop_front (); |
107 | return true; |
108 | return true; |
108 | } |
109 | } |
109 | else |
110 | else |
110 | return false; |
111 | return false; |
… | |
… | |
131 | |
132 | |
132 | draw_client_map (pl); |
133 | draw_client_map (pl); |
133 | |
134 | |
134 | if (update_look) |
135 | if (update_look) |
135 | esrv_draw_look (pl); |
136 | esrv_draw_look (pl); |
|
|
137 | |
|
|
138 | mapinfo_queue_run (); |
136 | |
139 | |
137 | #if HAVE_TCP_INFO |
140 | #if HAVE_TCP_INFO |
138 | // check time of last ack, and, if too old, kill connection |
141 | // check time of last ack, and, if too old, kill connection |
139 | socklen_t len = sizeof (tcpi); |
142 | socklen_t len = sizeof (tcpi); |
140 | |
143 | |