… | |
… | |
259 | /* IF the player is flying & trying to take the item out of a container |
259 | /* IF the player is flying & trying to take the item out of a container |
260 | * that is in his inventory, let him. tmp->env points to the container |
260 | * that is in his inventory, let him. tmp->env points to the container |
261 | * (sack, luggage, etc), tmp->env->env then points to the player (nested |
261 | * (sack, luggage, etc), tmp->env->env then points to the player (nested |
262 | * containers not allowed as of now) |
262 | * containers not allowed as of now) |
263 | */ |
263 | */ |
264 | if ((pl->move_type & MOVE_FLYING) && !QUERY_FLAG (pl, FLAG_WIZ) && is_player_inv (tmp) != pl) |
264 | if ((pl->move_type & MOVE_FLYING) && !QUERY_FLAG (pl, FLAG_WIZ) && tmp->in_player () != pl) |
265 | { |
265 | { |
266 | new_draw_info (NDI_UNIQUE, 0, pl, "You are levitating, you can't reach the ground!"); |
266 | new_draw_info (NDI_UNIQUE, 0, pl, "You are levitating, you can't reach the ground!"); |
267 | return; |
267 | return; |
268 | } |
268 | } |
269 | |
269 | |
… | |
… | |
702 | if (QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
702 | if (QUERY_FLAG (tmp, FLAG_STARTEQUIP)) |
703 | { |
703 | { |
704 | sprintf (buf, "You drop the %s.", query_name (tmp)); |
704 | sprintf (buf, "You drop the %s.", query_name (tmp)); |
705 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
705 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
706 | new_draw_info (NDI_UNIQUE, 0, op, "The gods who lent it to you retrieves it."); |
706 | new_draw_info (NDI_UNIQUE, 0, op, "The gods who lent it to you retrieves it."); |
|
|
707 | |
707 | if (op->type == PLAYER) |
708 | if (op->type == PLAYER) |
708 | esrv_del_item (op->contr, tmp->count); |
709 | esrv_del_item (op->contr, tmp->count); |
|
|
710 | |
709 | tmp->destroy (); |
711 | tmp->destroy (); |
710 | fix_player (op); |
712 | fix_player (op); |
711 | return; |
713 | return; |
712 | } |
714 | } |
713 | |
715 | |
… | |
… | |
736 | fix_player (op); /* This is overkill, fix_player() is called somewhere */ |
738 | fix_player (op); /* This is overkill, fix_player() is called somewhere */ |
737 | /* in object.c */ |
739 | /* in object.c */ |
738 | |
740 | |
739 | if (op->type == PLAYER) |
741 | if (op->type == PLAYER) |
740 | { |
742 | { |
741 | op->contr->socket.update_look = 1; |
|
|
742 | /* Need to update the weight for the player */ |
743 | /* Need to update the weight for the player */ |
743 | esrv_send_item (op, op); |
744 | esrv_send_item (op, op); |
|
|
745 | op->contr->ns->floorbox_update (); |
744 | } |
746 | } |
745 | |
747 | |
746 | for (floor = get_map_ob (op->map, op->x, op->y); floor; floor = floor->above) |
748 | for (floor = GET_MAP_OB (op->map, op->x, op->y); floor; floor = floor->above) |
747 | if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (tmp), ARG_OBJECT (op))) |
749 | if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (tmp), ARG_OBJECT (op))) |
748 | return; |
750 | return; |
749 | |
751 | |
750 | if (is_in_shop (op) && !QUERY_FLAG (tmp, FLAG_UNPAID) && tmp->type != MONEY) |
752 | if (is_in_shop (op) && !QUERY_FLAG (tmp, FLAG_UNPAID) && tmp->type != MONEY) |
751 | sell_item (tmp, op); |
753 | sell_item (tmp, op); |
… | |
… | |
800 | new_draw_info (NDI_UNIQUE, 0, op, "This item can't be dropped."); |
802 | new_draw_info (NDI_UNIQUE, 0, op, "This item can't be dropped."); |
801 | #endif |
803 | #endif |
802 | return; |
804 | return; |
803 | } |
805 | } |
804 | |
806 | |
805 | if (op->type == PLAYER) |
807 | if (op->type == PLAYER && op->contr->last_used == tmp) |
806 | { |
808 | op->contr->last_used = tmp->below ? tmp->below |
807 | if (op->contr->last_used == tmp && op->contr->last_used_id == tmp->count) |
809 | : tmp->above ? tmp->above |
808 | { |
810 | : 0; |
809 | object *n = NULL; |
|
|
810 | |
|
|
811 | if (tmp->below != NULL) |
|
|
812 | n = tmp->below; |
|
|
813 | else if (tmp->above != NULL) |
|
|
814 | n = tmp->above; |
|
|
815 | op->contr->last_used = n; |
|
|
816 | if (n != NULL) |
|
|
817 | op->contr->last_used_id = n->count; |
|
|
818 | else |
|
|
819 | op->contr->last_used_id = 0; |
|
|
820 | } |
|
|
821 | }; |
|
|
822 | |
811 | |
823 | if (op->container) |
812 | if (op->container) |
824 | { |
813 | { |
825 | if (op->type == PLAYER) |
814 | if (op->type == PLAYER) |
826 | { |
|
|
827 | put_object_in_sack (op, op->container, tmp, op->contr->count); |
815 | put_object_in_sack (op, op->container, tmp, op->contr->count); |
828 | } |
|
|
829 | else |
816 | else |
830 | { |
|
|
831 | put_object_in_sack (op, op->container, tmp, 0); |
817 | put_object_in_sack (op, op->container, tmp, 0); |
832 | }; |
|
|
833 | } |
818 | } |
834 | else |
819 | else |
835 | { |
820 | { |
836 | if (op->type == PLAYER) |
821 | if (op->type == PLAYER) |
837 | { |
|
|
838 | drop_object (op, tmp, op->contr->count); |
822 | drop_object (op, tmp, op->contr->count); |
839 | } |
|
|
840 | else |
823 | else |
841 | { |
|
|
842 | drop_object (op, tmp, 0); |
824 | drop_object (op, tmp, 0); |
843 | }; |
|
|
844 | } |
825 | } |
|
|
826 | |
845 | if (op->type == PLAYER) |
827 | if (op->type == PLAYER) |
846 | op->contr->count = 0; |
828 | op->contr->count = 0; |
847 | } |
829 | } |
848 | |
830 | |
849 | |
831 | |
… | |
… | |
957 | } |
939 | } |
958 | } |
940 | } |
959 | curinv = nextinv; |
941 | curinv = nextinv; |
960 | } |
942 | } |
961 | } |
943 | } |
962 | op->contr->socket.update_look = 1; |
944 | |
|
|
945 | op->contr->ns->floorbox_update (); |
963 | |
946 | |
964 | /* draw_look(op);*/ |
947 | /* draw_look(op);*/ |
965 | return 0; |
948 | return 0; |
966 | } |
949 | } |
967 | |
950 | |
… | |
… | |
997 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop."); |
980 | new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop."); |
998 | } |
981 | } |
999 | if (op->type == PLAYER) |
982 | if (op->type == PLAYER) |
1000 | { |
983 | { |
1001 | op->contr->count = 0; |
984 | op->contr->count = 0; |
1002 | op->contr->socket.update_look = 1; |
985 | op->contr->ns->floorbox_update (); |
1003 | }; |
986 | }; |
1004 | |
987 | |
1005 | /* draw_look(op);*/ |
988 | /* draw_look(op);*/ |
1006 | return 0; |
989 | return 0; |
1007 | } |
990 | } |