… | |
… | |
592 | */ |
592 | */ |
593 | |
593 | |
594 | INTERFACE_CLASS (archetype) |
594 | INTERFACE_CLASS (archetype) |
595 | struct archetype : object |
595 | struct archetype : object |
596 | { |
596 | { |
|
|
597 | static archetype *empty; // the empty_archetype |
|
|
598 | |
597 | archetype (const char *name); |
599 | archetype (const char *name); |
598 | ~archetype (); |
600 | ~archetype (); |
599 | void gather_callbacks (AV *&callbacks, event_type event) const; |
601 | void gather_callbacks (AV *&callbacks, event_type event) const; |
600 | |
602 | |
601 | static archetype *read (object_thawer &f); |
|
|
602 | |
|
|
603 | MTH static archetype *get (const_utf8_string name); // find or create |
|
|
604 | MTH static archetype *find (const_utf8_string name); |
603 | MTH static archetype *find (const_utf8_string name); |
605 | |
604 | |
606 | MTH void link (); |
605 | MTH void link (); |
607 | MTH void unlink (); |
606 | MTH void unlink (); |
608 | |
607 | |
609 | MTH object *instance (); |
608 | MTH object *instance (); |
610 | |
609 | |
611 | object_vector_index ACC (RW, archid); // index in archvector |
610 | object_vector_index ACC (RW, archid); // index in archvector |
612 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
611 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
613 | bool ACC (RW, stub); // if true, this is an invalid archetype |
|
|
614 | |
612 | |
615 | sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ |
613 | sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ |
616 | sint8 ACC (RW, max_x), ACC (RW, max_y); |
614 | sint8 ACC (RW, max_x), ACC (RW, max_y); |
|
|
615 | |
|
|
616 | // support for archetype loading |
|
|
617 | static archetype *read (object_thawer &f); |
|
|
618 | MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more |
|
|
619 | static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ |
617 | }; |
620 | }; |
618 | |
621 | |
619 | inline void |
622 | inline void |
620 | object_freezer::put (keyword k, archetype *v) |
623 | object_freezer::put (keyword k, archetype *v) |
621 | { |
624 | { |