… | |
… | |
972 | * it from the list of used objects, and puts it on the list of |
972 | * it from the list of used objects, and puts it on the list of |
973 | * free objects. The IS_FREED() flag is set in the object. |
973 | * free objects. The IS_FREED() flag is set in the object. |
974 | * The object must have been removed by remove_ob() first for |
974 | * The object must have been removed by remove_ob() first for |
975 | * this function to succeed. |
975 | * this function to succeed. |
976 | * |
976 | * |
977 | * If free_inventory is set, free inventory as well. Else drop items in |
977 | * If destroy_inventory is set, free inventory as well. Else drop items in |
978 | * inventory to the ground. |
978 | * inventory to the ground. |
979 | */ |
979 | */ |
980 | void object::free (bool free_inventory) |
980 | void object::destroy (bool destroy_inventory) |
981 | { |
981 | { |
982 | if (QUERY_FLAG (this, FLAG_FREED)) |
982 | if (QUERY_FLAG (this, FLAG_FREED)) |
983 | return; |
983 | return; |
984 | |
984 | |
985 | if (QUERY_FLAG (this, FLAG_FRIENDLY)) |
985 | if (QUERY_FLAG (this, FLAG_FRIENDLY)) |
… | |
… | |
990 | |
990 | |
991 | SET_FLAG (this, FLAG_FREED); |
991 | SET_FLAG (this, FLAG_FREED); |
992 | |
992 | |
993 | if (more) |
993 | if (more) |
994 | { |
994 | { |
995 | more->free (free_inventory); |
995 | more->destroy (destroy_inventory); |
996 | more = 0; |
996 | more = 0; |
997 | } |
997 | } |
998 | |
998 | |
999 | if (inv) |
999 | if (inv) |
1000 | { |
1000 | { |
1001 | /* Only if the space blocks everything do we not process - |
1001 | /* Only if the space blocks everything do we not process - |
1002 | * if some form of movement is allowed, let objects |
1002 | * if some form of movement is allowed, let objects |
1003 | * drop on that space. |
1003 | * drop on that space. |
1004 | */ |
1004 | */ |
1005 | if (free_inventory || !map || map->in_memory != MAP_IN_MEMORY || GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL) |
1005 | if (destroy_inventory || !map || map->in_memory != MAP_IN_MEMORY || GET_MAP_MOVE_BLOCK (map, x, y) == MOVE_ALL) |
1006 | { |
1006 | { |
1007 | object *op = inv; |
1007 | object *op = inv; |
1008 | |
1008 | |
1009 | while (op) |
1009 | while (op) |
1010 | { |
1010 | { |
1011 | object *tmp = op->below; |
1011 | object *tmp = op->below; |
1012 | op->free (free_inventory); |
1012 | op->destroy (destroy_inventory); |
1013 | op = tmp; |
1013 | op = tmp; |
1014 | } |
1014 | } |
1015 | } |
1015 | } |
1016 | else |
1016 | else |
1017 | { /* Put objects in inventory onto this space */ |
1017 | { /* Put objects in inventory onto this space */ |
… | |
… | |
1040 | |
1040 | |
1041 | // clear those pointers that likely might have circular references to us |
1041 | // clear those pointers that likely might have circular references to us |
1042 | owner = 0; |
1042 | owner = 0; |
1043 | enemy = 0; |
1043 | enemy = 0; |
1044 | attacked_by = 0; |
1044 | attacked_by = 0; |
|
|
1045 | |
|
|
1046 | // only relevant for players(?), but make sure of it anyways |
|
|
1047 | contr = 0; |
1045 | |
1048 | |
1046 | /* Remove object from the active list */ |
1049 | /* Remove object from the active list */ |
1047 | speed = 0; |
1050 | speed = 0; |
1048 | update_ob_speed (this); |
1051 | update_ob_speed (this); |
1049 | |
1052 | |