… | |
… | |
939 | map->insert (op, x, y); |
939 | map->insert (op, x, y); |
940 | } |
940 | } |
941 | } |
941 | } |
942 | } |
942 | } |
943 | |
943 | |
|
|
944 | /* |
|
|
945 | * Remove and free all objects in the inventory of the given object. |
|
|
946 | * Unlike destroy_inv, this assumes the *this is destroyed as well |
|
|
947 | * well, so we can (and have to!) take shortcuts. |
|
|
948 | */ |
|
|
949 | void |
|
|
950 | object::destroy_inv_fast () |
|
|
951 | { |
|
|
952 | while (object *op = inv) |
|
|
953 | { |
|
|
954 | // remove from object the fast way |
|
|
955 | op->flag [FLAG_REMOVED] = true; |
|
|
956 | op->env = 0; |
|
|
957 | if ((inv = inv->below)) |
|
|
958 | inv->above = 0; |
|
|
959 | |
|
|
960 | // then destroy |
|
|
961 | op->destroy (); |
|
|
962 | } |
|
|
963 | } |
|
|
964 | |
944 | object *object::create () |
965 | object *object::create () |
945 | { |
966 | { |
946 | object *op = new object; |
967 | object *op = new object; |
947 | op->link (); |
968 | op->link (); |
948 | return op; |
969 | return op; |
… | |
… | |
1018 | LOG (llevError | logBacktrace, "tried to destroy the tail of an object"); |
1039 | LOG (llevError | logBacktrace, "tried to destroy the tail of an object"); |
1019 | head->destroy (); |
1040 | head->destroy (); |
1020 | return; |
1041 | return; |
1021 | } |
1042 | } |
1022 | |
1043 | |
1023 | destroy_inv (false); |
1044 | destroy_inv_fast (); |
1024 | |
1045 | |
1025 | if (is_head ()) |
1046 | if (is_head ()) |
1026 | if (sound_destroy) |
1047 | if (sound_destroy) |
1027 | play_sound (sound_destroy); |
1048 | play_sound (sound_destroy); |
1028 | else if (flag [FLAG_MONSTER]) |
1049 | else if (flag [FLAG_MONSTER]) |