… | |
… | |
23 | */ |
23 | */ |
24 | |
24 | |
25 | #ifndef OBJECT_H |
25 | #ifndef OBJECT_H |
26 | #define OBJECT_H |
26 | #define OBJECT_H |
27 | |
27 | |
28 | #include <bitset> |
|
|
29 | |
|
|
30 | #include "cfperl.h" |
28 | #include "cfperl.h" |
31 | #include "shstr.h" |
29 | #include "shstr.h" |
32 | |
30 | |
33 | //+GPL |
31 | //+GPL |
34 | |
32 | |
35 | typedef int tag_t; |
33 | typedef int tag_t; |
36 | |
34 | |
37 | // also see common/item.C |
35 | // also see common/item.C |
38 | enum { |
36 | enum |
|
|
37 | { |
39 | body_skill, |
38 | body_skill, |
40 | body_combat, |
39 | body_combat, |
41 | body_range, |
40 | body_range, |
42 | body_shield, |
41 | body_shield, |
43 | body_arm, |
42 | body_arm, |
… | |
… | |
51 | body_wrist, |
50 | body_wrist, |
52 | body_waist, |
51 | body_waist, |
53 | NUM_BODY_LOCATIONS |
52 | NUM_BODY_LOCATIONS |
54 | }; |
53 | }; |
55 | |
54 | |
56 | enum slottype_t |
|
|
57 | { |
|
|
58 | slot_none, |
|
|
59 | slot_combat, |
|
|
60 | slot_ranged, |
|
|
61 | }; |
|
|
62 | |
|
|
63 | /* See common/item.c */ |
55 | /* See common/item.c */ |
64 | |
56 | |
65 | typedef struct Body_Locations |
57 | typedef struct Body_Locations |
66 | { |
58 | { |
67 | keyword save_name; /* Name used to load/save it to disk */ |
59 | keyword save_name; /* Name used to load/save it to disk */ |
… | |
… | |
290 | |
282 | |
291 | const_utf8_string query_weight (const object *op); |
283 | const_utf8_string query_weight (const object *op); |
292 | const_utf8_string query_short_name (const object *op); |
284 | const_utf8_string query_short_name (const object *op); |
293 | const_utf8_string query_name (const object *op); |
285 | const_utf8_string query_name (const object *op); |
294 | const_utf8_string query_base_name (const object *op, int plural); |
286 | const_utf8_string query_base_name (const object *op, int plural); |
|
|
287 | sint64 query_cost (const object *tmp, object *who, int flag); |
|
|
288 | const char *query_cost_string (const object *tmp, object *who, int flag); |
|
|
289 | |
|
|
290 | int change_ability_duration (object *spell, object *caster); |
|
|
291 | int min_casting_level (object *caster, object *spell); |
|
|
292 | int casting_level (object *caster, object *spell); |
|
|
293 | sint16 SP_level_spellpoint_cost (object *caster, object *spell, int flags); |
|
|
294 | int SP_level_dam_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); |
295 | |
297 | |
296 | struct object : zero_initialised, object_copy |
298 | struct object : zero_initialised, object_copy |
297 | { |
299 | { |
298 | // These variables are not changed by ->copy_to |
300 | // These variables are not changed by ->copy_to |
299 | maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ |
301 | maptile *ACC (RW, map); /* Pointer to the map in which this object is present */ |
… | |
… | |
361 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
363 | bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all |
362 | MTH void post_load_check (); // do some adjustments after parsing |
364 | MTH void post_load_check (); // do some adjustments after parsing |
363 | static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. |
365 | static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. |
364 | bool write (object_freezer &f); |
366 | bool write (object_freezer &f); |
365 | |
367 | |
366 | MTH int slottype () const; |
|
|
367 | MTH static object *create (); |
368 | MTH static object *create (); |
368 | const mapxy &operator =(const mapxy &pos); |
369 | const mapxy &operator =(const mapxy &pos); |
369 | MTH void copy_to (object *dst); |
370 | MTH void copy_to (object *dst); |
370 | MTH object *clone (); // create + copy_to a single object |
371 | MTH object *clone (); // create + copy_to a single object |
371 | MTH object *deep_clone (); // copy whole more chain and inventory |
372 | MTH object *deep_clone (); // copy whole more chain and inventory |
… | |
… | |
378 | destroy (); |
379 | destroy (); |
379 | } |
380 | } |
380 | |
381 | |
381 | // recursively destroy all objects in inventory, optionally dropping them to the ground instead |
382 | // recursively destroy all objects in inventory, optionally dropping them to the ground instead |
382 | MTH void destroy_inv (bool drop_to_ground = false); |
383 | MTH void destroy_inv (bool drop_to_ground = false); |
|
|
384 | MTH void destroy_inv_fast (); // like destroy_inv (false), but only works when *this is destroyed, too |
383 | MTH object *insert (object *item); // insert into inventory |
385 | MTH object *insert (object *item); // insert into inventory |
384 | MTH void play_sound (faceidx sound) const; |
386 | MTH void play_sound (faceidx sound) const; |
385 | MTH void say_msg (const_utf8_string msg) const; |
387 | MTH void say_msg (const_utf8_string msg) const; |
386 | |
388 | |
387 | void do_remove (); |
389 | void do_remove (); |
… | |
… | |
610 | |
612 | |
611 | MTH bool is_player () const |
613 | MTH bool is_player () const |
612 | { |
614 | { |
613 | return !!contr; |
615 | return !!contr; |
614 | } |
616 | } |
|
|
617 | |
|
|
618 | /* elmex: this method checks whether the object is in a shop */ |
|
|
619 | MTH bool is_in_shop () const; |
615 | |
620 | |
616 | MTH bool affects_los () const |
621 | MTH bool affects_los () const |
617 | { |
622 | { |
618 | return glow_radius || flag [FLAG_BLOCKSVIEW]; |
623 | return glow_radius || flag [FLAG_BLOCKSVIEW]; |
619 | } |
624 | } |