1 | |
1 | |
2 | /* |
2 | /* |
3 | * static char *rcsid_item_c = |
3 | * static char *rcsid_item_c = |
4 | * "$Id: item.c,v 1.1.1.2 2006/02/22 18:03:28 elmex Exp $"; |
4 | * "$Id: item.c,v 1.5 2006/08/13 17:16:06 elmex dead $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
288 | else head = tmp; |
288 | else head = tmp; |
289 | |
289 | |
290 | add_object_to_socklist(&pl->contr->socket, &sl, head); |
290 | add_object_to_socklist(&pl->contr->socket, &sl, head); |
291 | got_one++; |
291 | got_one++; |
292 | |
292 | |
293 | if (sl.len > (MAXSOCKBUF-MAXITEMLEN)) { |
293 | if (sl.len >= (MAXSOCKBUF-MAXITEMLEN)) { |
294 | Send_With_Handling(&pl->contr->socket, &sl); |
294 | Send_With_Handling(&pl->contr->socket, &sl); |
295 | sprintf((char*)sl.buf,"item%d ", pl->contr->socket.itemcmd); |
295 | sprintf((char*)sl.buf,"item%d ", pl->contr->socket.itemcmd); |
296 | sl.len=strlen((char*)sl.buf); |
296 | sl.len=strlen((char*)sl.buf); |
297 | SockList_AddInt(&sl, 0); |
297 | SockList_AddInt(&sl, 0); |
298 | got_one=0; |
298 | got_one=0; |
… | |
… | |
338 | |
338 | |
339 | /* IT is possible for players to accumulate a huge amount of |
339 | /* IT is possible for players to accumulate a huge amount of |
340 | * items (especially with some of the bags out there) to |
340 | * items (especially with some of the bags out there) to |
341 | * overflow the buffer. IF so, send multiple item commands. |
341 | * overflow the buffer. IF so, send multiple item commands. |
342 | */ |
342 | */ |
343 | if (sl.len > (MAXSOCKBUF-MAXITEMLEN)) { |
343 | if (sl.len >= (MAXSOCKBUF-MAXITEMLEN)) { |
344 | Send_With_Handling(&pl->contr->socket, &sl); |
344 | Send_With_Handling(&pl->contr->socket, &sl); |
345 | sprintf((char*)sl.buf,"item%d ", pl->contr->socket.itemcmd); |
345 | sprintf((char*)sl.buf,"item%d ", pl->contr->socket.itemcmd); |
346 | sl.len=strlen((char*)sl.buf); |
346 | sl.len=strlen((char*)sl.buf); |
347 | SockList_AddInt(&sl, op->count); |
347 | SockList_AddInt(&sl, op->count); |
348 | got_one=0; |
348 | got_one=0; |
… | |
… | |
657 | object *tmp; |
657 | object *tmp; |
658 | int flag=0; |
658 | int flag=0; |
659 | sint16 x,y; |
659 | sint16 x,y; |
660 | mapstruct *m; |
660 | mapstruct *m; |
661 | |
661 | |
662 | |
|
|
663 | if (out_of_map(op->map, op->x+dx, op->y+dy)) return; |
|
|
664 | |
|
|
665 | x = op->x + dx; |
662 | x = op->x + dx; |
666 | y = op->y + dy; |
663 | y = op->y + dy; |
|
|
664 | |
|
|
665 | if (out_of_map(op->map, x, y)) return; |
667 | |
666 | |
668 | m = get_map_from_coord(op->map, &x, &y); |
667 | m = get_map_from_coord(op->map, &x, &y); |
669 | if (!m) return; |
668 | if (!m) return; |
670 | |
669 | |
671 | for(tmp=get_map_ob(m, x ,y);tmp!=NULL&&tmp->above!=NULL; |
670 | for(tmp=get_map_ob(m, x ,y);tmp!=NULL&&tmp->above!=NULL; |
… | |
… | |
717 | if (!(cp=strchr(buf,' '))) { |
716 | if (!(cp=strchr(buf,' '))) { |
718 | return; |
717 | return; |
719 | } |
718 | } |
720 | dy=atoi(cp); |
719 | dy=atoi(cp); |
721 | |
720 | |
722 | if (FABS(dx)>MAP_CLIENT_X/2 || FABS(dy)>MAP_CLIENT_Y/2) |
721 | if (FABS(dx) > pl->socket.mapx / 2 || FABS(dy) > pl->socket.mapy / 2) |
723 | return; |
722 | return; |
724 | |
723 | |
725 | if(pl->blocked_los[dx+(pl->socket.mapx/2)][dy+(pl->socket.mapy/2)]) |
724 | if(pl->blocked_los[dx + pl->socket.mapx / 2][dy + pl->socket.mapy / 2]) |
726 | return; |
725 | return; |
|
|
726 | |
727 | look_at(pl->ob, dx, dy); |
727 | look_at(pl->ob, dx, dy); |
728 | } |
728 | } |
729 | |
729 | |
730 | /** Move an object to a new location */ |
730 | /** Move an object to a new location */ |
731 | void esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof) |
731 | void esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof) |