/* * Definition of an object. * If the object is inherited, then it must not be destructed ! * * The reset is used as follows: * 0: There is an error in the reset() in this object. Never call it again. * 1: Normal state. * 2 or higher: This is an interactive player, that has not given any commands * for a number of reset periods. */ #include "config.h" #define O_CREATED 0x02 /* Has 'create()' been called */ #define O_ENABLE_COMMANDS 0x04 /* Can it execute commands ? */ #define O_CLONE 0x08 /* Is it cloned from a master copy ? */ #define O_DESTRUCTED 0x10 /* Is it destructed ? */ #define O_SWAPPED 0x20 /* Is it swapped to file */ #define O_ONCE_INTERACTIVE 0x40 /* Has it ever been interactive ? */ struct call; struct object { unsigned short flags; /* Bits or'ed together from above */ unsigned short debug_flags; int created; /* Time of creation of this object */ int time_of_ref; /* Time when last referenced. Used by swap */ int ref; /* Reference count. */ #ifdef DEBUG int extra_ref; /* Used to check ref count. */ #endif int swap_num; /* Swap file offset. -1 is not swapped yet. */ struct program *prog; char *name; struct call *call_outs; struct object *next_call_out; struct object *next_all, *prev_all, *next_inv, *next_hash; struct object *contains; struct object *super; /* Which object surround us ? */ struct object *shadowing; /* Is this object shadowing ? */ struct object *shadowed; /* Is this object shadowed ? */ struct interactive *interactive; /* Data about an interactive player */ struct sentence *sent; struct object *next_hashed_living; char *living_name; /* Name of living object if in hash */ struct svalue *variables; /* All variables to this program */ }; extern struct object *load_object (char *, int, struct object *), *find_object (char *); extern struct object *get_empty_object(), *find_object (char *), *find_object2 (char *); extern struct object *current_object, *command_giver; extern struct object *obj_list; extern struct object *obj_list_destruct; struct value; void remove_destructed_objects(), save_object (struct object *, char *), move_object (struct object *), tell_object (struct object *, struct svalue *), tell_npc (struct object *, char *), add_ref (struct object *, char *), change_ref (struct object *, struct object *, char *), free_object (struct object *, char *), reference_prog (struct program *, char *); int restore_object (struct object *, char *);