--- deliantra/server/include/object.h 2006/09/12 01:26:07 1.31 +++ deliantra/server/include/object.h 2006/09/13 02:05:19 1.34 @@ -58,6 +58,13 @@ shstr key, value; }; +struct UUID +{ + uint64 seq; +}; + +extern void init_uuid (); +extern UUID gen_uuid (); /* Definition for WILL_APPLY values. Replaces having harcoded values * sprinkled in the code. Note that some of these also replace fields @@ -70,7 +77,6 @@ #define WILL_APPLY_DOOR 0x08 #define WILL_APPLY_FOOD 0x10 - /* However, if you're keeping a pointer of some sort, you probably * don't just want it copied, so you'll need to add to common/object.C, * e.g. copy_object. @@ -81,6 +87,7 @@ struct object_keep : refcounted { tag_t ACC (RW, count); /* Unique object number for this object */ + UUID uuid; // Unique Identifier, survives saves etc. /* These variables are not changed by copy_object() */ struct pl *ACC (RW, contr); /* Pointer to the player which control this object */ @@ -170,7 +177,6 @@ uint32 ACC (RW, tooltype); /* type of tool or build facility */ sint8 body_info[NUM_BODY_LOCATIONS]; /* body info as loaded from the file */ sint8 body_used[NUM_BODY_LOCATIONS]; /* Calculated value based on items equipped */ - uint8 ACC (RW, will_apply); /* See crossfire.doc */ /* See the doc/Developers/objects for more info about body locations */ /* Following mostly refers to fields only used for monsters */ @@ -214,6 +220,7 @@ uint8 ACC (RW, last_anim); /* last sequence used to draw face */ sint32 ACC (RW, elevation); /* elevation of this terrain - not currently used */ uint8 ACC (RW, smoothlevel); /* how to smooth this square around */ + uint8 ACC (RW, will_apply); /* See crossfire.doc */ MoveType ACC (RW, move_type); /* Type of movement this object uses */ MoveType ACC (RW, move_block); /* What movement types this blocks */ @@ -236,9 +243,21 @@ void clear (); void clone (object *destination); + void instantiate () + { + if (!uuid.seq) // HACK + uuid = gen_uuid (); + + attachable::instantiate (); + } + void set_owner (object *owner); object *get_owner (); + // info must hold 256 * 3 bytes currently + const char *debug_desc (char *info) const; + const char *debug_desc () const; + // fully recursive iterator struct iterator_base {