… | |
… | |
395 | /* we remove the check for op->env, because in theory, the object |
395 | /* we remove the check for op->env, because in theory, the object |
396 | * is hopefully in the same place, so the client should preserve |
396 | * is hopefully in the same place, so the client should preserve |
397 | * order. |
397 | * order. |
398 | */ |
398 | */ |
399 | } |
399 | } |
|
|
400 | |
400 | if (!QUERY_FLAG (op, FLAG_CLIENT_SENT)) |
401 | if (!QUERY_FLAG (op, FLAG_CLIENT_SENT)) |
401 | { |
402 | { |
402 | /* FLAG_CLIENT_SENT is debug only. We are using it to see where |
403 | /* FLAG_CLIENT_SENT is debug only. We are using it to see where |
403 | * this is happening - we can set a breakpoint here in the debugger |
404 | * this is happening - we can set a breakpoint here in the debugger |
404 | * and track back the call. |
405 | * and track back the call. |
405 | */ |
406 | */ |
406 | LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count); |
407 | LOG (llevDebug, "We have not sent item %s (%d)\n", &op->name, op->count); |
407 | } |
408 | } |
|
|
409 | |
408 | sl.buf = (unsigned char *) malloc (MAXSOCKBUF); |
410 | sl.buf = (unsigned char *) malloc (MAXSOCKBUF); |
409 | |
411 | |
410 | strcpy ((char *) sl.buf, "upditem "); |
412 | strcpy ((char *) sl.buf, "upditem "); |
411 | sl.len = strlen ((char *) sl.buf); |
413 | sl.len = strlen ((char *) sl.buf); |
412 | |
414 | |
… | |
… | |
438 | { |
440 | { |
439 | if (!(pl->contr->socket.faces_sent[op->face->number] & NS_FACESENT_FACE)) |
441 | if (!(pl->contr->socket.faces_sent[op->face->number] & NS_FACESENT_FACE)) |
440 | esrv_send_face (&pl->contr->socket, op->face->number, 0); |
442 | esrv_send_face (&pl->contr->socket, op->face->number, 0); |
441 | SockList_AddInt (&sl, op->face->number); |
443 | SockList_AddInt (&sl, op->face->number); |
442 | } |
444 | } |
|
|
445 | |
443 | if (flags & UPD_NAME) |
446 | if (flags & UPD_NAME) |
444 | { |
447 | { |
445 | int len; |
448 | int len; |
446 | const char *item_p; |
449 | const char *item_p; |
447 | char item_n[MAX_BUF]; |
450 | char item_n[MAX_BUF]; |
… | |
… | |
466 | len += strlen (item_n + 1 + len) + 1; |
469 | len += strlen (item_n + 1 + len) + 1; |
467 | SockList_AddChar (&sl, (char) len); |
470 | SockList_AddChar (&sl, (char) len); |
468 | memcpy (sl.buf + sl.len, item_n, len); |
471 | memcpy (sl.buf + sl.len, item_n, len); |
469 | sl.len += len; |
472 | sl.len += len; |
470 | } |
473 | } |
|
|
474 | |
471 | if (flags & UPD_ANIM) |
475 | if (flags & UPD_ANIM) |
472 | SockList_AddShort (&sl, op->animation_id); |
476 | SockList_AddShort (&sl, op->animation_id); |
473 | |
477 | |
474 | if (flags & UPD_ANIMSPEED) |
478 | if (flags & UPD_ANIMSPEED) |
475 | { |
479 | { |
… | |
… | |
655 | player_apply (pl->ob, op, 0, 0); |
659 | player_apply (pl->ob, op, 0, 0); |
656 | } |
660 | } |
657 | |
661 | |
658 | /** Client wants to apply some object. Lets do so. */ |
662 | /** Client wants to apply some object. Lets do so. */ |
659 | void |
663 | void |
660 | LockItem (uint8 * data, int len, player *pl) |
664 | LockItem (uint8 *data, int len, player *pl) |
661 | { |
665 | { |
662 | int flag, tag; |
|
|
663 | object *op; |
|
|
664 | |
|
|
665 | flag = data[0]; |
666 | int flag = data[0]; |
666 | tag = GetInt_String (data + 1); |
667 | tag_t tag = net_uint32 (data + 1); |
667 | op = esrv_get_ob_from_count (pl->ob, tag); |
668 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
668 | |
669 | |
669 | if (!op) |
670 | if (!op) |
670 | { |
671 | { |
671 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to lock/unlock"); |
672 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to lock/unlock"); |
672 | return; |
673 | return; |
673 | } |
674 | } |
|
|
675 | |
674 | if (!flag) |
676 | if (!flag) |
675 | CLEAR_FLAG (op, FLAG_INV_LOCKED); |
677 | CLEAR_FLAG (op, FLAG_INV_LOCKED); |
676 | else |
678 | else |
677 | SET_FLAG (op, FLAG_INV_LOCKED); |
679 | SET_FLAG (op, FLAG_INV_LOCKED); |
|
|
680 | |
678 | esrv_update_item (UPD_FLAGS, pl->ob, op); |
681 | esrv_update_item (UPD_FLAGS, pl->ob, op); |
679 | } |
682 | } |
680 | |
683 | |
681 | /** Client wants to apply some object. Lets do so. */ |
684 | /** Client wants to apply some object. Lets do so. */ |
682 | void |
685 | void |
683 | MarkItem (uint8 * data, int len, player *pl) |
686 | MarkItem (uint8 * data, int len, player *pl) |
684 | { |
687 | { |
685 | int tag; |
688 | tag_t tag = net_uint32 (data); |
686 | object *op; |
|
|
687 | |
|
|
688 | tag = GetInt_String (data); |
|
|
689 | op = esrv_get_ob_from_count (pl->ob, tag); |
689 | object *op = esrv_get_ob_from_count (pl->ob, tag); |
690 | |
690 | |
691 | if (!op) |
691 | if (!op) |
692 | { |
692 | { |
693 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to mark"); |
693 | new_draw_info (NDI_UNIQUE, 0, pl->ob, "Could not find object to mark"); |
694 | return; |
694 | return; |
695 | } |
695 | } |
696 | |
696 | |
697 | pl->mark = op; |
697 | pl->mark = op; |
698 | new_draw_info_format (NDI_UNIQUE, 0, pl->ob, "Marked item %s", query_name (op)); |
698 | new_draw_info_format (NDI_UNIQUE, 0, pl->ob, "Marked item %s", query_name (op)); |
699 | } |
699 | } |
700 | |
|
|
701 | |
700 | |
702 | /** |
701 | /** |
703 | * look_at prints items on the specified square. |
702 | * look_at prints items on the specified square. |
704 | * |
703 | * |
705 | * [ removed EARTHWALL check and added check for containers inventory. |
704 | * [ removed EARTHWALL check and added check for containers inventory. |