… | |
… | |
611 | if (!can_split (op, tmp, nrof)) |
611 | if (!can_split (op, tmp, nrof)) |
612 | return; |
612 | return; |
613 | |
613 | |
614 | drop_object (op, tmp); |
614 | drop_object (op, tmp); |
615 | |
615 | |
616 | if (!tmp->destroyed () && !tmp->is_in_map_or_inv ()) |
616 | if (!tmp->destroyed () && !tmp->is_inserted ()) |
617 | { |
617 | { |
618 | // if nothing happened with the object we give it back |
618 | // if nothing happened with the object we give it back |
619 | op->insert (tmp); |
619 | op->insert (tmp); |
620 | } |
620 | } |
621 | } |
621 | } |
… | |
… | |
635 | drop_object (object *dropper, object *obj) |
635 | drop_object (object *dropper, object *obj) |
636 | { |
636 | { |
637 | if (INVOKE_OBJECT (DROP, obj, ARG_OBJECT (dropper))) |
637 | if (INVOKE_OBJECT (DROP, obj, ARG_OBJECT (dropper))) |
638 | return; |
638 | return; |
639 | |
639 | |
640 | // safe guard for programming errors: |
|
|
641 | if (obj->destroyed () || obj->is_in_map_or_inv ()) |
640 | if (obj->destroyed () || obj->is_inserted ()) |
642 | { |
|
|
643 | LOG (llevError, "BUG: A plugin destroyed or put the object somewhere without overriding the DROP event (%s)!", obj->debug_desc ()); |
|
|
644 | return; |
641 | return; |
645 | } |
|
|
646 | |
642 | |
647 | if (QUERY_FLAG (obj, FLAG_STARTEQUIP)) |
643 | if (QUERY_FLAG (obj, FLAG_STARTEQUIP)) |
648 | { |
644 | { |
649 | dropper->statusmsg (format ("You drop the %s.", query_name (obj))); |
645 | dropper->statusmsg (format ("You drop the %s.", query_name (obj))); |
650 | dropper->statusmsg ("The god who lent it to you retrieves it."); |
646 | dropper->statusmsg ("The god who lent it to you retrieves it."); |
… | |
… | |
658 | floor; |
654 | floor; |
659 | floor = floor->above) |
655 | floor = floor->above) |
660 | if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (obj), ARG_OBJECT (dropper))) |
656 | if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (obj), ARG_OBJECT (dropper))) |
661 | return; |
657 | return; |
662 | |
658 | |
663 | // safe guard for programming errors: |
|
|
664 | if (obj->destroyed () || obj->is_in_map_or_inv ()) |
659 | if (obj->destroyed () || obj->is_inserted ()) |
665 | { |
|
|
666 | LOG (llevError, "BUG: A plugin destroyed or put the object somewhere without overriding the DROP_ON event (%s)!", obj->debug_desc ()); |
|
|
667 | return; |
660 | return; |
668 | } |
|
|
669 | |
661 | |
670 | if (is_in_shop (dropper) && !QUERY_FLAG (obj, FLAG_UNPAID) && obj->type != MONEY) |
662 | if (is_in_shop (dropper) && !QUERY_FLAG (obj, FLAG_UNPAID) && obj->type != MONEY) |
671 | if (!sell_item (obj, dropper)) |
663 | if (!sell_item (obj, dropper)) |
672 | return; |
664 | return; |
673 | |
665 | |