ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/object.h
(Generate patch)

Comparing deliantra/server/include/object.h (file contents):
Revision 1.174 by root, Sun May 4 15:22:14 2008 UTC vs.
Revision 1.177 by root, Sat May 17 00:17:02 2008 UTC

678 MTH static archetype *find (const_utf8_string name); 678 MTH static archetype *find (const_utf8_string name);
679 679
680 MTH void link (); 680 MTH void link ();
681 MTH void unlink (); 681 MTH void unlink ();
682 682
683 MTH static object *get (const char *name); // find()->instance() 683 MTH static object *get (const char *name); // (find() || singularity)->instance()
684 MTH object *instance (); 684 MTH object *instance ();
685 685
686 object_vector_index ACC (RW, archid); // index in archvector 686 object_vector_index ACC (RW, archid); // index in archvector
687 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ 687 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */
688 688
693 static archetype *read (object_thawer &f); 693 static archetype *read (object_thawer &f);
694 MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more 694 MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more
695 static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ 695 static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */
696}; 696};
697 697
698// compatbiility, remove once replaced by ->instance
699inline object *
700arch_to_object (archetype *at)
701{
702 return at->instance ();
703}
704
698inline void 705inline void
699object_freezer::put (keyword k, archetype *v) 706object_freezer::put (keyword k, archetype *v)
700{ 707{
701 put (k, v ? &v->archname : (const char *)0); 708 put (k, v ? &v->archname : (const char *)0);
702} 709}
707 714
708extern objectvec objects; 715extern objectvec objects;
709extern activevec actives; 716extern activevec actives;
710extern archvec archetypes; 717extern archvec archetypes;
711 718
719// "safely" iterate over inv in a way such that the current item is removable
720// quite horrible, thats why its hidden in some macro
721#define for_inv_removable(op,var) \
722 for (object *var, *next_ = (op)->inv; (var = next_), var && (next_ = var->below), var; )
723
712#define for_all_objects(var) \ 724#define for_all_objects(var) \
713 for (unsigned _i = 0; _i < objects.size (); ++_i) \ 725 for (unsigned _i = 0; _i < objects.size (); ++_i) \
714 statementvar (object *, var, objects [_i]) 726 statementvar (object *, var, objects [_i])
715 727
716#define for_all_actives(var) \ 728#define for_all_actives(var) \
717 for (unsigned _i = 0; _i < actives.size (); ++_i) \ 729 for (unsigned _i = 0; _i < actives.size (); ++_i) \
718 statementvar (object *, var, actives [_i]) 730 statementvar (object *, var, actives [_i])
719 731
720#define for_all_archetypes(var) \ 732#define for_all_archetypes(var) \
721 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ 733 for (unsigned _i = 0; _i < archetypes.size (); ++_i) \
722 statementvar (archetype *, var, archetypes [_i]) 734 statementvar (archetype *, var, archetypes [_i])
723 735
724/* Used by update_object to know if the object being passed is 736/* Used by update_object to know if the object being passed is
725 * being added or removed. 737 * being added or removed.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines