… | |
… | |
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 | |
… | |
… | |
321 | */ |
327 | */ |
322 | object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
328 | object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ |
323 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
329 | object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different |
324 | key_value *key_values; /* Fields not explictly known by the loader. */ |
330 | key_value *key_values; /* Fields not explictly known by the loader. */ |
325 | |
331 | |
|
|
332 | MTH void set_flag (int flagnum) |
|
|
333 | { |
|
|
334 | flag [flagnum] = true; |
|
|
335 | } |
|
|
336 | |
|
|
337 | MTH void clr_flag (int flagnum) |
|
|
338 | { |
|
|
339 | flag [flagnum] = false; |
|
|
340 | } |
|
|
341 | |
326 | // privates / perl |
342 | // privates / perl |
327 | shstr_tmp kv_get (shstr_tmp key) const; |
343 | shstr_tmp kv_get (shstr_tmp key) const; |
328 | void kv_del (shstr_tmp key); |
344 | void kv_del (shstr_tmp key); |
329 | void kv_set (shstr_tmp key, shstr_tmp value); |
345 | void kv_set (shstr_tmp key, shstr_tmp value); |
330 | |
346 | |
… | |
… | |
432 | } |
448 | } |
433 | |
449 | |
434 | MTH void set_owner (object *owner); |
450 | MTH void set_owner (object *owner); |
435 | MTH void set_speed (float speed); |
451 | MTH void set_speed (float speed); |
436 | MTH void set_glow_radius (sint8 rad); |
452 | MTH void set_glow_radius (sint8 rad); |
437 | MTH bool change_skill (object *ob); // deprecated? |
|
|
438 | |
453 | |
439 | MTH void open_container (object *new_container); |
454 | MTH void open_container (object *new_container); |
440 | MTH void close_container () |
455 | MTH void close_container () |
441 | { |
456 | { |
442 | open_container (0); |
457 | open_container (0); |
… | |
… | |
649 | // anywhere. |
664 | // anywhere. |
650 | MTH void expand_tail (); |
665 | MTH void expand_tail (); |
651 | |
666 | |
652 | MTH void create_treasure (treasurelist *tl, int flags = 0); |
667 | MTH void create_treasure (treasurelist *tl, int flags = 0); |
653 | |
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 | |
654 | // insert object at same map position as 'where' |
675 | // insert object at same map position as 'where' |
655 | // handles both inventory and map "positions" |
676 | // handles both inventory and map "positions" |
656 | 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); |
657 | // 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 |
658 | 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); |
… | |
… | |
757 | MTH int anim_frames () const { return anim ().num_animations; } |
778 | MTH int anim_frames () const { return anim ().num_animations; } |
758 | MTH int anim_facings () const { return anim ().facings; } |
779 | MTH int anim_facings () const { return anim ().facings; } |
759 | |
780 | |
760 | MTH utf8_string as_string (); |
781 | MTH utf8_string as_string (); |
761 | |
782 | |
|
|
783 | // low-level management, statistics, ... |
|
|
784 | static uint32_t ACC (RW, object_count); |
|
|
785 | static uint32_t ACC (RW, free_count); |
|
|
786 | static uint32_t ACC (RW, create_count); |
|
|
787 | static uint32_t ACC (RW, destroy_count); |
|
|
788 | static freelist_item *freelist; |
|
|
789 | MTH static void freelist_free (int count); |
|
|
790 | |
762 | protected: |
791 | protected: |
763 | void link (); |
792 | void link (); |
764 | void unlink (); |
793 | void unlink (); |
|
|
794 | |
|
|
795 | void do_delete (); |
765 | |
796 | |
766 | object (); |
797 | object (); |
767 | ~object (); |
798 | ~object (); |
768 | |
799 | |
769 | private: |
800 | private: |
… | |
… | |
806 | */ |
837 | */ |
807 | |
838 | |
808 | //-GPL |
839 | //-GPL |
809 | |
840 | |
810 | INTERFACE_CLASS (archetype) |
841 | INTERFACE_CLASS (archetype) |
811 | struct archetype : object |
842 | struct archetype : object, zero_initialised |
812 | { |
843 | { |
813 | static arch_ptr empty; // the empty_archetype |
844 | static arch_ptr empty; // the empty_archetype |
814 | MTH static void gc (); |
845 | MTH static void gc (); |
815 | |
846 | |
816 | archetype (const_utf8_string name); |
847 | archetype (const_utf8_string name); |
… | |
… | |
834 | |
865 | |
835 | // support for archetype loading |
866 | // support for archetype loading |
836 | static archetype *read (object_thawer &f); |
867 | static archetype *read (object_thawer &f); |
837 | MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more |
868 | MTH static void commit_load (); // commit any objects loaded, resolves cyclic dependencies and more |
838 | static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ |
869 | static void postpone_arch_ref (arch_ptr &ref, const_utf8_string other_arch); /* postpone other_arch reference */ |
|
|
870 | |
|
|
871 | protected: |
|
|
872 | void do_delete (); |
839 | }; |
873 | }; |
840 | |
874 | |
841 | // returns whether the object is a dragon player, which are often specialcased |
875 | // returns whether the object is a dragon player, which are often specialcased |
842 | inline bool |
876 | inline bool |
843 | object::is_dragon () const |
877 | object::is_dragon () const |