--- deliantra/server/include/object.h 2008/04/09 14:36:47 1.154 +++ deliantra/server/include/object.h 2008/04/20 00:44:12 1.160 @@ -90,15 +90,36 @@ { uint64 seq; + static UUID cur; // last uuid generated + static void init (); + static UUID gen (); + UUID () { } UUID (uint64 seq) : seq(seq) { } operator uint64() { return seq; } void operator =(uint64 seq) { this->seq = seq; } -}; -extern void init_uuid (); -extern UUID gen_uuid (); -extern const uint64 UUID_SKIP; + typedef char BUF [32]; + + bool parse (const char *s) + { + return sscanf (s, "<1.%" SCNx64 ">", &seq) == 1; + } + + const char *c_str (char *buf, int len) const + { + snprintf (buf, len, "<1.%" PRIx64 ">", seq); + + return buf; + } + + const char *c_str () const + { + static BUF buf; + + return c_str (buf, sizeof (buf)); + } +}; /* Definition for WILL_APPLY values. Replaces having harcoded values * sprinkled in the code. Note that some of these also replace fields @@ -450,7 +471,7 @@ MTH void activate_recursive (); MTH void deactivate_recursive (); - // set the givne flag on all objects in the inventory recursively + // set the given flag on all objects in the inventory recursively MTH void set_flag_inv (int flag, int value = 1); void enter_exit (object *exit);//Perl @@ -553,7 +574,7 @@ typedef struct oblinkpt { /* Used to link together several object links */ struct oblnk *link; - long value; /* Used as connected value in buttons/gates */ + sint32 value; /* Used as connected value in buttons/gates */ struct oblinkpt *next; } oblinkpt; @@ -573,13 +594,12 @@ INTERFACE_CLASS (archetype) struct archetype : object { + static archetype *empty; // the empty_archetype + archetype (const char *name); ~archetype (); void gather_callbacks (AV *&callbacks, event_type event) const; - static archetype *read (object_thawer &f); - - MTH static archetype *get (const_utf8_string name); // find or create MTH static archetype *find (const_utf8_string name); MTH void link (); @@ -589,10 +609,14 @@ object_vector_index ACC (RW, archid); // index in archvector shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ - bool ACC (RW, stub); // if true, this is an invalid archetype sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ sint8 ACC (RW, max_x), ACC (RW, max_y); + + // support for archetype loading + static archetype *read (object_thawer &f); + MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more + static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ }; inline void