ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/object.C
(Generate patch)

Comparing deliantra/server/common/object.C (file contents):
Revision 1.87 by root, Tue Dec 26 08:54:59 2006 UTC vs.
Revision 1.88 by root, Tue Dec 26 09:37:00 2006 UTC

804 if (flag [FLAG_FREED]) 804 if (flag [FLAG_FREED])
805 return; 805 return;
806 806
807 flag [FLAG_FREED] = 1; 807 flag [FLAG_FREED] = 1;
808 808
809 while (inv)
810 inv->destroy ();
811
812 set_speed (0);
813 unlink ();
814
809 // hack to ensure that freed objects still have a valid map 815 // hack to ensure that freed objects still have a valid map
810 { 816 {
811 static maptile *freed_map; // freed objects are moved here to avoid crashes 817 static maptile *freed_map; // freed objects are moved here to avoid crashes
812 818
813 if (!freed_map) 819 if (!freed_map)
824 map = freed_map; 830 map = freed_map;
825 x = 1; 831 x = 1;
826 y = 1; 832 y = 1;
827 } 833 }
828 834
829 more = 0;
830 head = 0; 835 head = 0;
831 inv = 0; 836
837 if (more)
838 {
839 more->destroy ();
840 more = 0;
841 }
832 842
833 // clear those pointers that likely might have circular references to us 843 // clear those pointers that likely might have circular references to us
834 owner = 0; 844 owner = 0;
835 enemy = 0; 845 enemy = 0;
836 attacked_by = 0; 846 attacked_by = 0;
837 847
838 // only relevant for players(?), but make sure of it anyways 848 // only relevant for players(?), but make sure of it anyways
839 contr = 0; 849 contr = 0;
840
841 /* Remove object from the active list */
842 set_speed (0);
843
844 unlink ();
845} 850}
846 851
847/* 852/*
848 * Remove and free all objects in the inventory of the given object. 853 * Remove and free all objects in the inventory of the given object.
849 * object.c ? 854 * object.c ?
850 */ 855 */
851void 856void
852object::destroy_inv (bool drop_to_ground) 857object::destroy_inv (bool drop_to_ground)
853{ 858{
854 if (!inv)
855 return;
856
857 /* Only if the space blocks everything do we not process - 859 /* Only if the space blocks everything do we not process -
858 * if some form of movement is allowed, let objects 860 * if some form of movement is allowed, let objects
859 * drop on that space. 861 * drop on that space.
860 */ 862 */
861 if (!drop_to_ground || !map || map->in_memory != MAP_IN_MEMORY || GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL) 863 if (!drop_to_ground || !map || map->in_memory != MAP_IN_MEMORY || GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL)
862 { 864 {
863 while (inv) 865 while (inv)
864 {
865 inv->destroy_inv (drop_to_ground);
866 inv->destroy (); 866 inv->destroy ();
867 }
868 } 867 }
869 else 868 else
870 { /* Put objects in inventory onto this space */ 869 { /* Put objects in inventory onto this space */
871 while (inv) 870 while (inv)
872 { 871 {
892void 891void
893object::destroy (bool destroy_inventory) 892object::destroy (bool destroy_inventory)
894{ 893{
895 if (destroyed ()) 894 if (destroyed ())
896 return; 895 return;
897
898 if (more)
899 {
900 //TODO: non-head objects must not have inventory
901 more->destroy (destroy_inventory);
902 more = 0;
903 }
904 896
905 if (destroy_inventory) 897 if (destroy_inventory)
906 destroy_inv (true); 898 destroy_inv (true);
907 899
908 attachable::destroy (); 900 attachable::destroy ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines