… | |
… | |
911 | mortals.erase (i); |
911 | mortals.erase (i); |
912 | } |
912 | } |
913 | |
913 | |
914 | static int lastmortals = 0;//D |
914 | static int lastmortals = 0;//D |
915 | |
915 | |
916 | if (mortals.size() != lastmortals)//D |
916 | if (mortals.size() != lastmortals && lastmortals > 100)//D |
917 | { |
917 | { |
918 | lastmortals = mortals.size ();//D |
918 | lastmortals = mortals.size ();//D |
919 | LOG (llevDebug, "%d objects in mortal queue\n", lastmortals);//D |
919 | LOG (llevDebug, "%d objects in mortal queue\n", lastmortals);//D |
920 | } |
920 | } |
921 | } |
921 | } |
… | |
… | |
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 | |
… | |
… | |
1213 | |
1216 | |
1214 | tmp->contr->socket.update_look = 1; |
1217 | tmp->contr->socket.update_look = 1; |
1215 | } |
1218 | } |
1216 | |
1219 | |
1217 | /* See if player moving off should effect something */ |
1220 | /* See if player moving off should effect something */ |
1218 | if (check_walk_off && ((op->move_type & tmp->move_off) && (op->move_type & ~tmp->move_off & ~tmp->move_block) == 0)) |
1221 | if (check_walk_off |
|
|
1222 | && ((op->move_type & tmp->move_off) |
|
|
1223 | && (op->move_type & ~tmp->move_off & ~tmp->move_block) == 0)) |
1219 | { |
1224 | { |
1220 | move_apply (tmp, op, NULL); |
1225 | move_apply (tmp, op, NULL); |
1221 | |
1226 | |
1222 | if (op->destroyed ()); |
1227 | if (op->destroyed ()) |
1223 | LOG (llevError, "BUG: remove_ob(): name %s, archname %s destroyed " "leaving object\n", &tmp->name, &tmp->arch->name); |
1228 | LOG (llevError, "BUG: remove_ob(): name %s, destroyed leaving object\n", tmp->debug_desc ()); |
1224 | } |
1229 | } |
1225 | |
1230 | |
1226 | /* Eneq(@csd.uu.se): Fixed this to skip tmp->above=tmp */ |
1231 | /* Eneq(@csd.uu.se): Fixed this to skip tmp->above=tmp */ |
1227 | |
1232 | |
1228 | if (tmp->above == tmp) |
1233 | if (tmp->above == tmp) |