1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_init_c = |
3 | * static char *rcsid_init_c = |
4 | * "$Id: request.C,v 1.17 2006/09/12 19:20:09 root Exp $"; |
4 | * "$Id: request.C,v 1.18 2006/09/14 19:08:41 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
50 | * operations |
50 | * operations |
51 | * |
51 | * |
52 | * esrv_map_doneredraw finishes the map update, and ships across the |
52 | * esrv_map_doneredraw finishes the map update, and ships across the |
53 | * map updates. |
53 | * map updates. |
54 | * |
54 | * |
55 | * esrv_map_scroll tells the client to scroll the map, and does similarily |
|
|
56 | * for the locally cached copy. |
|
|
57 | */ |
55 | */ |
58 | |
56 | |
59 | #include <global.h> |
57 | #include <global.h> |
60 | #include <sproto.h> |
58 | #include <sproto.h> |
61 | |
59 | |
… | |
… | |
1444 | |
1442 | |
1445 | if (sl.len > (int) strlen ("map ") || ns->sent_scroll) |
1443 | if (sl.len > (int) strlen ("map ") || ns->sent_scroll) |
1446 | { |
1444 | { |
1447 | /* All of this is just accounting stuff */ |
1445 | /* All of this is just accounting stuff */ |
1448 | if (tframes > 100) |
1446 | if (tframes > 100) |
1449 | { |
|
|
1450 | tframes = tbytes = 0; |
1447 | tframes = tbytes = 0; |
1451 | } |
1448 | |
1452 | tframes++; |
1449 | tframes++; |
1453 | frames++; |
1450 | frames++; |
1454 | tbytes += sl.len; |
1451 | tbytes += sl.len; |
1455 | bytes += sl.len; |
1452 | bytes += sl.len; |
1456 | memcpy (&ns->lastmap, newmap, sizeof (struct Map)); |
1453 | memcpy (&ns->lastmap, newmap, sizeof (struct Map)); |
1457 | Send_With_Handling (ns, &sl); |
1454 | Send_With_Handling (ns, &sl); |
1458 | ns->sent_scroll = 0; |
1455 | ns->sent_scroll = 0; |
1459 | } |
1456 | } |
|
|
1457 | |
1460 | free (sl.buf); |
1458 | free (sl.buf); |
1461 | } |
1459 | } |
1462 | |
1460 | |
1463 | |
1461 | |
1464 | /** Clears a map cell */ |
1462 | /** Clears a map cell */ |
… | |
… | |
2221 | * it doesn't need draw! |
2219 | * it doesn't need draw! |
2222 | */ |
2220 | */ |
2223 | ewhatflag &= (~EMI_NOREDRAW); |
2221 | ewhatflag &= (~EMI_NOREDRAW); |
2224 | esl.buf[ewhatstart + 1] = ewhatflag & 0xff; |
2222 | esl.buf[ewhatstart + 1] = ewhatflag & 0xff; |
2225 | } |
2223 | } |
|
|
2224 | |
2226 | if (esl.len > estartlen) |
2225 | if (esl.len > estartlen) |
2227 | { |
|
|
2228 | Send_With_Handling (&socket, &esl); |
2226 | Send_With_Handling (&socket, &esl); |
2229 | } |
2227 | |
2230 | free (esl.buf); |
2228 | free (esl.buf); |
2231 | } |
2229 | } |
|
|
2230 | |
2232 | if (sl.len > startlen || socket.sent_scroll) |
2231 | if (sl.len > startlen || socket.sent_scroll) |
2233 | { |
2232 | { |
2234 | Send_With_Handling (&socket, &sl); |
2233 | Send_With_Handling (&socket, &sl); |
2235 | socket.sent_scroll = 0; |
2234 | socket.sent_scroll = 0; |
2236 | } |
2235 | } |
|
|
2236 | |
2237 | free (sl.buf); |
2237 | free (sl.buf); |
2238 | } |
2238 | } |
2239 | |
2239 | |
2240 | /** |
2240 | /** |
2241 | * Draws client map. |
2241 | * Draws client map. |