… | |
… | |
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. |
… | |
… | |
968 | |
966 | |
969 | op = tmp; |
967 | op = tmp; |
970 | } |
968 | } |
971 | } |
969 | } |
972 | } |
970 | } |
|
|
971 | |
|
|
972 | // hack to ensure that freed objects still have a valid map |
|
|
973 | { |
|
|
974 | static maptile *freed_map; // freed objects are moved here to avoid crashes |
|
|
975 | |
|
|
976 | if (!freed_map) |
|
|
977 | { |
|
|
978 | freed_map = new maptile; |
|
|
979 | |
|
|
980 | freed_map->name = "/internal/freed_objects_map"; |
|
|
981 | freed_map->width = 3; |
|
|
982 | freed_map->height = 3; |
|
|
983 | |
|
|
984 | freed_map->allocate (); |
|
|
985 | } |
|
|
986 | |
|
|
987 | map = freed_map; |
|
|
988 | x = 1; |
|
|
989 | y = 1; |
|
|
990 | } |
973 | |
991 | |
974 | // clear those pointers that likely might have circular references to us |
992 | // clear those pointers that likely might have circular references to us |
975 | owner = 0; |
993 | owner = 0; |
976 | enemy = 0; |
994 | enemy = 0; |
977 | attacked_by = 0; |
995 | attacked_by = 0; |