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. |
… | |
… | |
131 | |
131 | |
132 | draw_client_map (pl); |
132 | draw_client_map (pl); |
133 | |
133 | |
134 | if (update_look) |
134 | if (update_look) |
135 | esrv_draw_look (pl); |
135 | esrv_draw_look (pl); |
|
|
136 | |
|
|
137 | mapinfo_queue_run (); |
136 | |
138 | |
137 | #if HAVE_TCP_INFO |
139 | #if HAVE_TCP_INFO |
138 | // check time of last ack, and, if too old, kill connection |
140 | // check time of last ack, and, if too old, kill connection |
139 | socklen_t len = sizeof (tcpi); |
141 | socklen_t len = sizeof (tcpi); |
140 | |
142 | |
… | |
… | |
153 | tcpi.tcpi_snd_ssthresh, tcpi.tcpi_snd_cwnd, tcpi.tcpi_advmss, tcpi.tcpi_pmtu, tcpi.tcpi_advmss, |
155 | tcpi.tcpi_snd_ssthresh, tcpi.tcpi_snd_cwnd, tcpi.tcpi_advmss, tcpi.tcpi_pmtu, tcpi.tcpi_advmss, |
154 | |
156 | |
155 | tcpi.tcpi_snd_cwnd - (tcpi.tcpi_unacked - tcpi.tcpi_sacked)); |
157 | tcpi.tcpi_snd_cwnd - (tcpi.tcpi_unacked - tcpi.tcpi_sacked)); |
156 | #endif |
158 | #endif |
157 | |
159 | |
|
|
160 | // fast-time-out a player by checking for missign acks |
158 | // do this only when player is active |
161 | // do this only when player is active |
159 | if (pl && pl->active |
162 | if (pl && pl->active |
160 | && tcpi.tcpi_last_ack_recv > int (SOCKET_TIMEOUT * 1000)) |
163 | && tcpi.tcpi_last_ack_recv > int (SOCKET_TIMEOUT * 1000)) |
161 | { |
164 | { |
162 | send_msg (NDI_RED | NDI_REPLY, "connection-timeout", "safety disconnect due to tcp/ip timeout (no packets received)"); |
165 | send_msg (NDI_RED | NDI_REPLY, "connection-timeout", "safety disconnect due to tcp/ip timeout (no packets received)"); |
… | |
… | |
189 | { |
192 | { |
190 | ++scrub_idx; |
193 | ++scrub_idx; |
191 | |
194 | |
192 | if (!faces_sent [scrub_idx]) |
195 | if (!faces_sent [scrub_idx]) |
193 | if (faceinfo *f = face_info (scrub_idx)) |
196 | if (faceinfo *f = face_info (scrub_idx)) |
194 | if (f->type == FT_FACE) // only scrub faces for now |
197 | if (f->type == FT_FACE || f->type == FT_SOUND) // only scrub faces and sounds for now |
195 | { |
198 | { |
196 | send_face (scrub_idx, -120); |
199 | send_face (scrub_idx, -120); |
197 | flush_fx (); |
200 | flush_fx (); |
198 | |
201 | |
199 | bg_scrub = 1; // send up to one fx per tick, unless an image was requested |
202 | bg_scrub = 1; // send up to one fx per tick, unless an image was requested |