… | |
… | |
537 | // set the given flag on all objects in the inventory recursively |
537 | // set the given flag on all objects in the inventory recursively |
538 | MTH void set_flag_inv (int flag, int value = 1); |
538 | MTH void set_flag_inv (int flag, int value = 1); |
539 | |
539 | |
540 | void enter_exit (object *exit);//Perl |
540 | void enter_exit (object *exit);//Perl |
541 | MTH void enter_map (maptile *newmap, int x, int y); |
541 | MTH void enter_map (maptile *newmap, int x, int y); |
|
|
542 | void player_goto (const char *path, int x, int y); // only for players |
542 | |
543 | |
543 | // returns the mapspace this object is in |
544 | // returns the mapspace this object is in |
544 | mapspace &ms () const; |
545 | mapspace &ms () const; |
545 | |
546 | |
546 | // fully recursive iterator |
547 | // fully recursive iterator |
… | |
… | |
677 | MTH static archetype *find (const_utf8_string name); |
678 | MTH static archetype *find (const_utf8_string name); |
678 | |
679 | |
679 | MTH void link (); |
680 | MTH void link (); |
680 | MTH void unlink (); |
681 | MTH void unlink (); |
681 | |
682 | |
682 | MTH static object *get (const char *name); // find()->instance() |
683 | MTH static object *get (const char *name); // (find() || singularity)->instance() |
683 | MTH object *instance (); |
684 | MTH object *instance (); |
684 | |
685 | |
685 | object_vector_index ACC (RW, archid); // index in archvector |
686 | object_vector_index ACC (RW, archid); // index in archvector |
686 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
687 | shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ |
687 | |
688 | |
… | |
… | |
692 | static archetype *read (object_thawer &f); |
693 | static archetype *read (object_thawer &f); |
693 | 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 |
694 | 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 */ |
695 | }; |
696 | }; |
696 | |
697 | |
|
|
698 | // compatbiility, remove once replaced by ->instance |
|
|
699 | inline object * |
|
|
700 | arch_to_object (archetype *at) |
|
|
701 | { |
|
|
702 | return at->instance (); |
|
|
703 | } |
|
|
704 | |
697 | inline void |
705 | inline void |
698 | object_freezer::put (keyword k, archetype *v) |
706 | object_freezer::put (keyword k, archetype *v) |
699 | { |
707 | { |
700 | put (k, v ? &v->archname : (const char *)0); |
708 | put (k, v ? &v->archname : (const char *)0); |
701 | } |
709 | } |
… | |
… | |
706 | |
714 | |
707 | extern objectvec objects; |
715 | extern objectvec objects; |
708 | extern activevec actives; |
716 | extern activevec actives; |
709 | extern archvec archetypes; |
717 | extern archvec archetypes; |
710 | |
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 | |
711 | #define for_all_objects(var) \ |
724 | #define for_all_objects(var) \ |
712 | for (unsigned _i = 0; _i < objects.size (); ++_i) \ |
725 | for (unsigned _i = 0; _i < objects.size (); ++_i) \ |
713 | statementvar (object *, var, objects [_i]) |
726 | statementvar (object *, var, objects [_i]) |
714 | |
727 | |
715 | #define for_all_actives(var) \ |
728 | #define for_all_actives(var) \ |
716 | for (unsigned _i = 0; _i < actives.size (); ++_i) \ |
729 | for (unsigned _i = 0; _i < actives.size (); ++_i) \ |
717 | statementvar (object *, var, actives [_i]) |
730 | statementvar (object *, var, actives [_i]) |
718 | |
731 | |
719 | #define for_all_archetypes(var) \ |
732 | #define for_all_archetypes(var) \ |
720 | for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ |
733 | for (unsigned _i = 0; _i < archetypes.size (); ++_i) \ |
721 | statementvar (archetype *, var, archetypes [_i]) |
734 | statementvar (archetype *, var, archetypes [_i]) |
722 | |
735 | |
723 | /* 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 |
724 | * being added or removed. |
737 | * being added or removed. |