… | |
… | |
412 | */ |
412 | */ |
413 | |
413 | |
414 | object * |
414 | object * |
415 | find_object (tag_t i) |
415 | find_object (tag_t i) |
416 | { |
416 | { |
417 | object *op; |
|
|
418 | |
|
|
419 | for (op = object::first; op != NULL; op = op->next) |
417 | for (object *op = object::first; op; op = op->next) |
420 | if (op->count == i) |
418 | if (op->count == i) |
421 | break; |
419 | return op; |
422 | |
420 | |
423 | return op; |
421 | return 0; |
424 | } |
422 | } |
425 | |
423 | |
426 | /* |
424 | /* |
427 | * Returns the first object which has a name equal to the argument. |
425 | * Returns the first object which has a name equal to the argument. |
428 | * Used only by the patch command, but not all that useful. |
426 | * Used only by the patch command, but not all that useful. |
… | |
… | |
920 | |
918 | |
921 | if (!QUERY_FLAG (this, FLAG_REMOVED)) |
919 | if (!QUERY_FLAG (this, FLAG_REMOVED)) |
922 | remove_ob (this); |
920 | remove_ob (this); |
923 | |
921 | |
924 | SET_FLAG (this, FLAG_FREED); |
922 | SET_FLAG (this, FLAG_FREED); |
|
|
923 | |
|
|
924 | // hack to ensure that freed objects still have a valid map |
|
|
925 | { |
|
|
926 | static maptile *freed_map; // freed objects are moved here to avoid crashes |
|
|
927 | |
|
|
928 | if (!freed_map) |
|
|
929 | { |
|
|
930 | freed_map = get_empty_map (3, 3); |
|
|
931 | freed_map->name = "freed objects map"; |
|
|
932 | allocate_map (freed_map); |
|
|
933 | } |
|
|
934 | |
|
|
935 | map = freed_map; |
|
|
936 | x = 1; |
|
|
937 | y = 1; |
|
|
938 | } |
925 | |
939 | |
926 | if (more) |
940 | if (more) |
927 | { |
941 | { |
928 | more->destroy (destroy_inventory); |
942 | more->destroy (destroy_inventory); |
929 | more = 0; |
943 | more = 0; |