… | |
… | |
670 | face = blank_face; |
670 | face = blank_face; |
671 | } |
671 | } |
672 | |
672 | |
673 | object::~object () |
673 | object::~object () |
674 | { |
674 | { |
675 | if (index) |
|
|
676 | unlink (); |
675 | unlink (); |
677 | |
676 | |
678 | free_key_values (this); |
677 | free_key_values (this); |
679 | } |
678 | } |
680 | |
679 | |
681 | static int object_count; |
680 | static int object_count; |
… | |
… | |
690 | objects.insert (this); |
689 | objects.insert (this); |
691 | } |
690 | } |
692 | |
691 | |
693 | void object::unlink () |
692 | void object::unlink () |
694 | { |
693 | { |
695 | assert (index);//D |
694 | if (!index) |
|
|
695 | return; |
|
|
696 | |
696 | objects.erase (this); |
697 | objects.erase (this); |
697 | refcnt_dec (); |
698 | refcnt_dec (); |
698 | } |
699 | } |
699 | |
700 | |
700 | void |
701 | void |
… | |
… | |
774 | * drop on that space. |
775 | * drop on that space. |
775 | */ |
776 | */ |
776 | if (!drop_to_ground |
777 | if (!drop_to_ground |
777 | || !map |
778 | || !map |
778 | || map->in_memory != MAP_IN_MEMORY |
779 | || map->in_memory != MAP_IN_MEMORY |
|
|
780 | || map->nodrop |
779 | || ms ().move_block == MOVE_ALL) |
781 | || ms ().move_block == MOVE_ALL) |
780 | { |
782 | { |
781 | while (inv) |
783 | while (inv) |
782 | { |
784 | { |
783 | inv->destroy_inv (drop_to_ground); |
785 | inv->destroy_inv (drop_to_ground); |
… | |
… | |
899 | * This function removes the object op from the linked list of objects |
901 | * This function removes the object op from the linked list of objects |
900 | * which it is currently tied to. When this function is done, the |
902 | * which it is currently tied to. When this function is done, the |
901 | * object will have no environment. If the object previously had an |
903 | * object will have no environment. If the object previously had an |
902 | * environment, the x and y coordinates will be updated to |
904 | * environment, the x and y coordinates will be updated to |
903 | * the previous environment. |
905 | * the previous environment. |
904 | * Beware: This function is called from the editor as well! |
|
|
905 | */ |
906 | */ |
906 | void |
907 | void |
907 | object::remove_slow () |
908 | object::remove_slow () |
908 | { |
909 | { |
909 | object *tmp, *last = 0; |
910 | object *tmp, *last = 0; |