… | |
… | |
997 | attacked_by = 0; |
997 | attacked_by = 0; |
998 | current_weapon = 0; |
998 | current_weapon = 0; |
999 | } |
999 | } |
1000 | |
1000 | |
1001 | void |
1001 | void |
1002 | object::destroy (bool destroy_inventory) |
1002 | object::destroy () |
1003 | { |
1003 | { |
1004 | if (destroyed ()) |
1004 | if (destroyed ()) |
1005 | return; |
1005 | return; |
1006 | |
1006 | |
1007 | if (!is_head () && !head->destroyed ()) |
1007 | if (!is_head () && !head->destroyed ()) |
1008 | { |
1008 | { |
1009 | LOG (llevError | logBacktrace, "tried to destroy the tail of an object"); |
1009 | LOG (llevError | logBacktrace, "tried to destroy the tail of an object"); |
1010 | head->destroy (destroy_inventory); |
1010 | head->destroy (); |
1011 | return; |
1011 | return; |
1012 | } |
1012 | } |
1013 | |
1013 | |
1014 | destroy_inv (!destroy_inventory); |
1014 | destroy_inv (false); |
1015 | |
1015 | |
1016 | if (is_head ()) |
1016 | if (is_head ()) |
1017 | if (sound_destroy) |
1017 | if (sound_destroy) |
1018 | play_sound (sound_destroy); |
1018 | play_sound (sound_destroy); |
1019 | else if (flag [FLAG_MONSTER]) |
1019 | else if (flag [FLAG_MONSTER]) |
… | |
… | |
1263 | * just 'op' otherwise |
1263 | * just 'op' otherwise |
1264 | */ |
1264 | */ |
1265 | object * |
1265 | object * |
1266 | insert_ob_in_map (object *op, maptile *m, object *originator, int flag) |
1266 | insert_ob_in_map (object *op, maptile *m, object *originator, int flag) |
1267 | { |
1267 | { |
1268 | if (op->is_on_map ()) |
|
|
1269 | { |
|
|
1270 | LOG (llevError, "insert_ob_in_map called for object already on map"); |
|
|
1271 | abort (); |
|
|
1272 | } |
|
|
1273 | |
|
|
1274 | if (op->env) |
|
|
1275 | { |
|
|
1276 | LOG (llevError, "insert_ob_in_map called for object in an inventory (proceeding)"); |
|
|
1277 | op->remove (); |
1268 | op->remove (); |
1278 | } |
|
|
1279 | |
1269 | |
1280 | if (m == &freed_map)//D TODO: remove soon |
1270 | if (m == &freed_map)//D TODO: remove soon |
1281 | {//D |
1271 | {//D |
1282 | LOG (llevError | logBacktrace, "tries to insret object on freed objects map: %s", op->debug_desc ());//D |
1272 | LOG (llevError | logBacktrace, "tries to insret object on freed objects map: %s", op->debug_desc ());//D |
1283 | }//D |
1273 | }//D |
… | |
… | |
1971 | * head of the object should correspond for the entire object. |
1961 | * head of the object should correspond for the entire object. |
1972 | */ |
1962 | */ |
1973 | if (OB_TYPE_MOVE_BLOCK (ob, ms.move_block)) |
1963 | if (OB_TYPE_MOVE_BLOCK (ob, ms.move_block)) |
1974 | continue; |
1964 | continue; |
1975 | |
1965 | |
1976 | if (ob->blocked (m, pos.x, pos.y)) |
1966 | if (ob->blocked (pos.m, pos.x, pos.y)) |
1977 | continue; |
1967 | continue; |
1978 | |
1968 | |
1979 | altern [index++] = i; |
1969 | altern [index++] = i; |
1980 | } |
1970 | } |
1981 | |
1971 | |