1 | |
|
|
2 | /* |
|
|
3 | * static char *rcsid_init_c = |
|
|
4 | * "$Id: request.C,v 1.17 2006/09/12 19:20:09 root Exp $"; |
|
|
5 | */ |
|
|
6 | |
|
|
7 | /* |
1 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
2 | CrossFire, A Multiplayer game for X-windows |
9 | |
3 | |
10 | Copyright (C) 2001 Mark Wedel |
4 | Copyright (C) 2001 Mark Wedel |
11 | Copyright (C) 1992 Frank Tore Johansen |
5 | Copyright (C) 1992 Frank Tore Johansen |
… | |
… | |
22 | |
16 | |
23 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
24 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | |
20 | |
27 | The author can be reached via e-mail to crossfire-devel@real-time.com |
21 | The author can be reached via e-mail to <crossfire@schmorp.de> |
28 | */ |
22 | */ |
29 | |
23 | |
30 | /** |
24 | /** |
31 | * \file |
25 | * \file |
32 | * Client handling. |
26 | * Client handling. |
… | |
… | |
50 | * operations |
44 | * operations |
51 | * |
45 | * |
52 | * esrv_map_doneredraw finishes the map update, and ships across the |
46 | * esrv_map_doneredraw finishes the map update, and ships across the |
53 | * map updates. |
47 | * map updates. |
54 | * |
48 | * |
55 | * esrv_map_scroll tells the client to scroll the map, and does similarily |
|
|
56 | * for the locally cached copy. |
|
|
57 | */ |
49 | */ |
58 | |
50 | |
59 | #include <global.h> |
51 | #include <global.h> |
60 | #include <sproto.h> |
52 | #include <sproto.h> |
61 | |
53 | |
… | |
… | |
1444 | |
1436 | |
1445 | if (sl.len > (int) strlen ("map ") || ns->sent_scroll) |
1437 | if (sl.len > (int) strlen ("map ") || ns->sent_scroll) |
1446 | { |
1438 | { |
1447 | /* All of this is just accounting stuff */ |
1439 | /* All of this is just accounting stuff */ |
1448 | if (tframes > 100) |
1440 | if (tframes > 100) |
1449 | { |
|
|
1450 | tframes = tbytes = 0; |
1441 | tframes = tbytes = 0; |
1451 | } |
1442 | |
1452 | tframes++; |
1443 | tframes++; |
1453 | frames++; |
1444 | frames++; |
1454 | tbytes += sl.len; |
1445 | tbytes += sl.len; |
1455 | bytes += sl.len; |
1446 | bytes += sl.len; |
1456 | memcpy (&ns->lastmap, newmap, sizeof (struct Map)); |
1447 | memcpy (&ns->lastmap, newmap, sizeof (struct Map)); |
1457 | Send_With_Handling (ns, &sl); |
1448 | Send_With_Handling (ns, &sl); |
1458 | ns->sent_scroll = 0; |
1449 | ns->sent_scroll = 0; |
1459 | } |
1450 | } |
|
|
1451 | |
1460 | free (sl.buf); |
1452 | free (sl.buf); |
1461 | } |
1453 | } |
1462 | |
1454 | |
1463 | |
1455 | |
1464 | /** Clears a map cell */ |
1456 | /** Clears a map cell */ |
… | |
… | |
2221 | * it doesn't need draw! |
2213 | * it doesn't need draw! |
2222 | */ |
2214 | */ |
2223 | ewhatflag &= (~EMI_NOREDRAW); |
2215 | ewhatflag &= (~EMI_NOREDRAW); |
2224 | esl.buf[ewhatstart + 1] = ewhatflag & 0xff; |
2216 | esl.buf[ewhatstart + 1] = ewhatflag & 0xff; |
2225 | } |
2217 | } |
|
|
2218 | |
2226 | if (esl.len > estartlen) |
2219 | if (esl.len > estartlen) |
2227 | { |
|
|
2228 | Send_With_Handling (&socket, &esl); |
2220 | Send_With_Handling (&socket, &esl); |
2229 | } |
2221 | |
2230 | free (esl.buf); |
2222 | free (esl.buf); |
2231 | } |
2223 | } |
|
|
2224 | |
2232 | if (sl.len > startlen || socket.sent_scroll) |
2225 | if (sl.len > startlen || socket.sent_scroll) |
2233 | { |
2226 | { |
2234 | Send_With_Handling (&socket, &sl); |
2227 | Send_With_Handling (&socket, &sl); |
2235 | socket.sent_scroll = 0; |
2228 | socket.sent_scroll = 0; |
2236 | } |
2229 | } |
|
|
2230 | |
2237 | free (sl.buf); |
2231 | free (sl.buf); |
2238 | } |
2232 | } |
2239 | |
2233 | |
2240 | /** |
2234 | /** |
2241 | * Draws client map. |
2235 | * Draws client map. |