… | |
… | |
506 | */ |
506 | */ |
507 | void |
507 | void |
508 | esrv_update_item (int flags, object *pl, object *op) |
508 | esrv_update_item (int flags, object *pl, object *op) |
509 | { |
509 | { |
510 | /* If we have a request to send the player item, skip a few checks. */ |
510 | /* If we have a request to send the player item, skip a few checks. */ |
511 | if (op != pl) |
|
|
512 | { |
|
|
513 | if (!op->client_visible ()) |
511 | if (op != pl && !op->client_visible ()) |
514 | return; |
512 | return; |
515 | /* we remove the check for op->env, because in theory, the object |
|
|
516 | * is hopefully in the same place, so the client should preserve |
|
|
517 | * order. |
|
|
518 | */ |
|
|
519 | } |
|
|
520 | |
513 | |
521 | client *ns = pl->contr->ns; |
514 | client *ns = pl->contr->ns; |
522 | if (!ns) |
515 | if (!ns) |
523 | return; |
516 | return; |
524 | |
517 | |
… | |
… | |
546 | if (flags & UPD_FLAGS) |
539 | if (flags & UPD_FLAGS) |
547 | sl << uint32 (query_flags (op)); |
540 | sl << uint32 (query_flags (op)); |
548 | |
541 | |
549 | if (flags & UPD_WEIGHT) |
542 | if (flags & UPD_WEIGHT) |
550 | { |
543 | { |
551 | sint32 weight = op->client_weight (); |
544 | sint32 weight = op->flag [FLAG_NO_PICK] ? -1 : op->client_weight (); |
552 | |
545 | |
553 | sl << uint32 (QUERY_FLAG (op, FLAG_NO_PICK) ? -1 : weight); |
|
|
554 | |
|
|
555 | #if 0 |
|
|
556 | if (pl == op) |
546 | if (op) |
557 | ns->last_weight = weight; |
547 | ns->last_weight = weight; |
558 | #endif |
548 | |
|
|
549 | sl << uint32 (weight); |
559 | } |
550 | } |
560 | |
551 | |
561 | if (flags & UPD_FACE) |
552 | if (flags & UPD_FACE) |
562 | { |
553 | { |
563 | ns->send_face (op->face, -50); |
554 | ns->send_face (op->face, -50); |
… | |
… | |
943 | op->failmsg ("Only dropped some items, can't drop that many items at once."); |
934 | op->failmsg ("Only dropped some items, can't drop that many items at once."); |
944 | } |
935 | } |
945 | else |
936 | else |
946 | drop_object (pl, op, nrof); |
937 | drop_object (pl, op, nrof); |
947 | |
938 | |
948 | update_after_inventory_change (pl); |
|
|
949 | |
|
|
950 | return; |
939 | return; |
951 | } |
940 | } |
952 | else if (to == pl->count) |
941 | else if (to == pl->count) |
953 | { /* pick it up to the inventory */ |
942 | { /* pick it up to the inventory */ |
954 | /* return if player has already picked it up */ |
943 | /* return if player has already picked it up */ |
… | |
… | |
970 | /* put_object_in_sack presumes that necessary sanity checking |
959 | /* put_object_in_sack presumes that necessary sanity checking |
971 | * has already been done (eg, it can be picked up and fits in |
960 | * has already been done (eg, it can be picked up and fits in |
972 | * in a sack, so check for those things. We should also check |
961 | * in a sack, so check for those things. We should also check |
973 | * an make sure env is in fact a container for that matter. |
962 | * an make sure env is in fact a container for that matter. |
974 | */ |
963 | */ |
975 | if (env->type == CONTAINER && can_pick (pl, op) && sack_can_hold (pl, env, op, nrof)) |
964 | if (env->type == CONTAINER |
976 | { |
965 | && can_pick (pl, op) |
|
|
966 | && sack_can_hold (pl, env, op, nrof)) |
977 | put_object_in_sack (pl, env, op, nrof); |
967 | put_object_in_sack (pl, env, op, nrof); |
978 | update_after_inventory_change (pl); |
|
|
979 | } |
|
|
980 | } |
968 | } |
981 | |
969 | |