… | |
… | |
293 | sint16 SP_level_spellpoint_cost (object *caster, object *spell, int flags); |
293 | sint16 SP_level_spellpoint_cost (object *caster, object *spell, int flags); |
294 | int SP_level_dam_adjust (object *caster, object *spob); |
294 | int SP_level_dam_adjust (object *caster, object *spob); |
295 | int SP_level_duration_adjust (object *caster, object *spob); |
295 | int SP_level_duration_adjust (object *caster, object *spob); |
296 | int SP_level_range_adjust (object *caster, object *spob); |
296 | int SP_level_range_adjust (object *caster, object *spob); |
297 | |
297 | |
|
|
298 | struct freelist_item |
|
|
299 | { |
|
|
300 | freelist_item *next; |
|
|
301 | uint32_t count; |
|
|
302 | }; |
|
|
303 | |
298 | struct object : zero_initialised, object_copy |
304 | struct object : object_copy |
299 | { |
305 | { |
300 | // These variables are not changed by ->copy_to |
306 | // These variables are not changed by ->copy_to |
301 | maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ |
307 | maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ |
302 | |
308 | |
303 | UUID ACC (RW, uuid); // Unique Identifier, survives saves etc. |
309 | UUID ACC (RW, uuid); // Unique Identifier, survives saves etc. |
304 | int ACC (RO, count); |
310 | uint32_t ACC (RO, count); |
305 | object_vector_index ACC (RO, index); // index into objects |
311 | object_vector_index ACC (RO, index); // index into objects |
306 | object_vector_index ACC (RO, active); // index into actives |
312 | object_vector_index ACC (RO, active); // index into actives |
307 | |
313 | |
308 | player_ptr ACC (RW, contr); /* Pointer to the player which control this object, ALWAYS set *iff* type == PLAYER */ |
314 | player_ptr ACC (RW, contr); /* Pointer to the player which control this object, ALWAYS set *iff* type == PLAYER */ |
309 | |
315 | |
… | |
… | |
658 | // anywhere. |
664 | // anywhere. |
659 | MTH void expand_tail (); |
665 | MTH void expand_tail (); |
660 | |
666 | |
661 | MTH void create_treasure (treasurelist *tl, int flags = 0); |
667 | MTH void create_treasure (treasurelist *tl, int flags = 0); |
662 | |
668 | |
|
|
669 | // makes sure the player has the named skill, |
|
|
670 | // and also makes it innate if can_use is true. |
|
|
671 | // returns the new skill or 0 if no such skill exists. |
|
|
672 | MTH object *give_skill (shstr_cmp name, bool can_use = false); |
|
|
673 | MTH void become_follower (object *new_god); |
|
|
674 | |
663 | // insert object at same map position as 'where' |
675 | // insert object at same map position as 'where' |
664 | // handles both inventory and map "positions" |
676 | // handles both inventory and map "positions" |
665 | MTH object *insert_at (object *where, object *originator = 0, int flags = 0); |
677 | MTH object *insert_at (object *where, object *originator = 0, int flags = 0); |
666 | // check whether we can put this into the map, respect max_nrof, max_volume, max_items |
678 | // check whether we can put this into the map, respect max_nrof, max_volume, max_items |
667 | MTH bool can_drop_at (maptile *m, int x, int y, object *originator = 0); |
679 | MTH bool can_drop_at (maptile *m, int x, int y, object *originator = 0); |
… | |
… | |
677 | |
689 | |
678 | void enter_exit (object *exit);//Perl |
690 | void enter_exit (object *exit);//Perl |
679 | MTH void enter_map (maptile *newmap, int x, int y); |
691 | MTH void enter_map (maptile *newmap, int x, int y); |
680 | void player_goto (const_utf8_string path, int x, int y); // only for players |
692 | void player_goto (const_utf8_string path, int x, int y); // only for players |
681 | MTH bool apply (object *ob, int aflags = AP_APPLY); // ob may be 0 |
693 | MTH bool apply (object *ob, int aflags = AP_APPLY); // ob may be 0 |
|
|
694 | |
|
|
695 | MTH object *mark () const; |
682 | |
696 | |
683 | // returns the mapspace this object is in |
697 | // returns the mapspace this object is in |
684 | mapspace &ms () const; |
698 | mapspace &ms () const; |
685 | |
699 | |
686 | // fully recursive iterator |
700 | // fully recursive iterator |
… | |
… | |
766 | MTH int anim_frames () const { return anim ().num_animations; } |
780 | MTH int anim_frames () const { return anim ().num_animations; } |
767 | MTH int anim_facings () const { return anim ().facings; } |
781 | MTH int anim_facings () const { return anim ().facings; } |
768 | |
782 | |
769 | MTH utf8_string as_string (); |
783 | MTH utf8_string as_string (); |
770 | |
784 | |
|
|
785 | // low-level management, statistics, ... |
|
|
786 | static uint32_t ACC (RW, object_count); |
|
|
787 | static uint32_t ACC (RW, free_count); |
|
|
788 | static uint32_t ACC (RW, create_count); |
|
|
789 | static uint32_t ACC (RW, destroy_count); |
|
|
790 | static freelist_item *freelist; |
|
|
791 | MTH static void freelist_free (int count); |
|
|
792 | |
771 | protected: |
793 | protected: |
772 | void link (); |
794 | void link (); |
773 | void unlink (); |
795 | void unlink (); |
|
|
796 | |
|
|
797 | void do_delete (); |
774 | |
798 | |
775 | object (); |
799 | object (); |
776 | ~object (); |
800 | ~object (); |
777 | |
801 | |
778 | private: |
802 | private: |
… | |
… | |
815 | */ |
839 | */ |
816 | |
840 | |
817 | //-GPL |
841 | //-GPL |
818 | |
842 | |
819 | INTERFACE_CLASS (archetype) |
843 | INTERFACE_CLASS (archetype) |
820 | struct archetype : object |
844 | struct archetype : object, zero_initialised |
821 | { |
845 | { |
822 | static arch_ptr empty; // the empty_archetype |
846 | static arch_ptr empty; // the empty_archetype |
823 | MTH static void gc (); |
847 | MTH static void gc (); |
824 | |
848 | |
825 | archetype (const_utf8_string name); |
849 | archetype (const_utf8_string name); |
… | |
… | |
843 | |
867 | |
844 | // support for archetype loading |
868 | // support for archetype loading |
845 | static archetype *read (object_thawer &f); |
869 | static archetype *read (object_thawer &f); |
846 | MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more |
870 | MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more |
847 | static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ |
871 | static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ |
|
|
872 | |
|
|
873 | protected: |
|
|
874 | void do_delete (); |
848 | }; |
875 | }; |
849 | |
876 | |
850 | // returns whether the object is a dragon player, which are often specialcased |
877 | // returns whether the object is a dragon player, which are often specialcased |
851 | inline bool |
878 | inline bool |
852 | object::is_dragon () const |
879 | object::is_dragon () const |