1 | /* |
1 | /* |
2 | * static char *rcsid_init_c = |
2 | * static char *rcsid_init_c = |
3 | * "$Id: request.c,v 1.2 2006/04/15 22:38:31 root Exp $"; |
3 | * "$Id: request.c,v 1.4 2006/04/16 04:36:34 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
120 | if (pl->socket.current_map != ob->map) |
120 | if (pl->socket.current_map != ob->map) |
121 | { |
121 | { |
122 | pl->socket.current_map = ob->map; |
122 | pl->socket.current_map = ob->map; |
123 | |
123 | |
124 | if (ob->map && ob->map->path [0]) |
124 | if (ob->map && ob->map->path [0]) |
|
|
125 | { |
|
|
126 | int flags = 0; |
|
|
127 | |
|
|
128 | if (ob->map->tile_map [0]) flags |= 1; |
|
|
129 | if (ob->map->tile_map [1]) flags |= 2; |
|
|
130 | if (ob->map->tile_map [2]) flags |= 4; |
|
|
131 | if (ob->map->tile_map [3]) flags |= 8; |
|
|
132 | |
125 | snprintf (buf, MAX_BUF, "mapinfo current %d %d %d %d %s", |
133 | snprintf (buf, MAX_BUF, "mapinfo current %d %d %d %d %d %s", |
126 | ob->x, ob->y, |
134 | flags, ob->x - pl->socket.mapx / 2, ob->y - pl->socket.mapy / 2, |
127 | ob->map->width, ob->map->height, ob->map->path); |
135 | ob->map->width, ob->map->height, ob->map->path); |
|
|
136 | } |
128 | else |
137 | else |
129 | snprintf (buf, MAX_BUF, "mapinfo current"); |
138 | snprintf (buf, MAX_BUF, "mapinfo current"); |
130 | |
139 | |
131 | Write_String_To_Socket (&pl->socket, buf, strlen (buf)); |
140 | Write_String_To_Socket (&pl->socket, buf, strlen (buf)); |
132 | } |
141 | } |
… | |
… | |
702 | { |
711 | { |
703 | if( pl->socket.newmapcmd == 1) { |
712 | if( pl->socket.newmapcmd == 1) { |
704 | memset(&pl->socket.lastmap, 0, sizeof(pl->socket.lastmap)); |
713 | memset(&pl->socket.lastmap, 0, sizeof(pl->socket.lastmap)); |
705 | Write_String_To_Socket( &pl->socket, "newmap", 6); |
714 | Write_String_To_Socket( &pl->socket, "newmap", 6); |
706 | } |
715 | } |
707 | check_map_change (pl); |
|
|
708 | } |
716 | } |
709 | |
717 | |
710 | |
718 | |
711 | |
719 | |
712 | /** |
720 | /** |
… | |
… | |
1467 | uint16 mask,emask; |
1475 | uint16 mask,emask; |
1468 | uint8 eentrysize; |
1476 | uint8 eentrysize; |
1469 | uint16 ewhatstart,ewhatflag; |
1477 | uint16 ewhatstart,ewhatflag; |
1470 | uint8 extendedinfos; |
1478 | uint8 extendedinfos; |
1471 | mapstruct *m; |
1479 | mapstruct *m; |
1472 | |
|
|
1473 | check_map_change (pl->contr); |
|
|
1474 | |
1480 | |
1475 | sl.buf=malloc(MAXSOCKBUF); |
1481 | sl.buf=malloc(MAXSOCKBUF); |
1476 | if (pl->contr->socket.mapmode == Map1Cmd) |
1482 | if (pl->contr->socket.mapmode == Map1Cmd) |
1477 | strcpy((char*)sl.buf,"map1 "); |
1483 | strcpy((char*)sl.buf,"map1 "); |
1478 | else |
1484 | else |
… | |
… | |
1759 | if (sl.len>startlen || pl->contr->socket.sent_scroll) { |
1765 | if (sl.len>startlen || pl->contr->socket.sent_scroll) { |
1760 | Send_With_Handling(&pl->contr->socket, &sl); |
1766 | Send_With_Handling(&pl->contr->socket, &sl); |
1761 | pl->contr->socket.sent_scroll = 0; |
1767 | pl->contr->socket.sent_scroll = 0; |
1762 | } |
1768 | } |
1763 | free(sl.buf); |
1769 | free(sl.buf); |
|
|
1770 | |
|
|
1771 | check_map_change (pl->contr); |
1764 | } |
1772 | } |
1765 | |
1773 | |
1766 | /** |
1774 | /** |
1767 | * Draws client map. |
1775 | * Draws client map. |
1768 | */ |
1776 | */ |
… | |
… | |
1881 | } |
1889 | } |
1882 | } /* Is a valid space */ |
1890 | } /* Is a valid space */ |
1883 | } |
1891 | } |
1884 | } |
1892 | } |
1885 | esrv_map_doneredraw(&pl->contr->socket, &newmap); |
1893 | esrv_map_doneredraw(&pl->contr->socket, &newmap); |
|
|
1894 | |
|
|
1895 | check_map_change (pl->contr); |
1886 | } |
1896 | } |
1887 | |
1897 | |
1888 | |
1898 | |
1889 | void esrv_map_scroll(NewSocket *ns,int dx,int dy) |
1899 | void esrv_map_scroll(NewSocket *ns,int dx,int dy) |
1890 | { |
1900 | { |