Go to the documentation of this file.
19 #ifndef OBJECT_UTIL_H
20 #define OBJECT_UTIL_H
22 /* Maximum number of scroll titles generated */
23 #define MAX_TITLES 50
25 /* An item's pval (for charges, amount of gold, etc) is limited to s16b */
26 #define MAX_PVAL 32767
28 void flavor_init(void);
29 void flavor_set_all_aware(void);
30 void object_flags(const struct object *obj, bitflag flags[OF_SIZE]);
31 void object_flags_known(const struct object *obj, bitflag flags[OF_SIZE]);
32 bool object_test(item_tester tester, const struct object *o);
33 bool item_test(item_tester tester, int item);
34 bool is_unknown(const struct object *obj);
35 unsigned check_for_inscrip(const struct object *obj, const char *inscrip);
36 struct object_kind *lookup_kind(int tval, int sval);
37 struct object_kind *objkind_byid(int kidx);
38 struct artifact *lookup_artifact_name(const char *name);
39 struct ego_item *lookup_ego_item(const char *name, int tval, int sval);
40 int lookup_sval(int tval, const char *name);
41 void object_short_name(char *buf, size_t max, const char *name);
42 int compare_items(const struct object *o1, const struct object *o2);
43 bool obj_has_charges(const struct object *obj);
44 bool obj_can_zap(const struct object *obj);
45 bool obj_is_activatable(const struct object *obj);
46 bool obj_can_activate(const struct object *obj);
47 bool obj_can_refill(const struct object *obj);
48 bool obj_kind_can_browse(const struct object_kind *kind);
49 bool obj_can_browse(const struct object *obj);
50 bool obj_can_cast_from(const struct object *obj);
51 bool obj_can_study(const struct object *obj);
52 bool obj_can_takeoff(const struct object *obj);
53 bool obj_can_wear(const struct object *obj);
54 bool obj_can_fire(const struct object *obj);
55 bool obj_has_inscrip(const struct object *obj);
56 bool obj_has_flag(const struct object *obj, int flag);
57 bool obj_is_useable(const struct object *obj);
58 struct effect *object_effect(const struct object *obj);
59 bool obj_needs_aim(struct object *obj);
60 bool obj_can_fail(const struct object *o);
62 int get_use_device_chance(const struct object *obj);
63 void distribute_charges(struct object *source, struct object *dest, int amt);
64 int number_charging(const struct object *obj);
65 bool recharge_timeout(struct object *obj);
66 bool verify_object(const char *prompt, struct object *obj);
67 void print_custom_message(struct object *obj, const char *string, int msg_type);
70 #endif /* OBJECT_UTIL_H */
bool(* item_tester)(const struct object *)
Definition: object.h:513
bool obj_can_browse(const struct object *obj)
Definition: obj-util.c:628
bool obj_is_activatable(const struct object *obj)
Determine if an object is activatable.
Definition: obj-util.c:573
struct artifact * lookup_artifact_name(const char *name)
Return the a_idx of the artifact with the given name.
Definition: obj-util.c:392
bool object_test(item_tester tester, const struct object *o)
Apply a tester function, skipping all non-objects and gold.
Definition: obj-util.c:296
bool obj_has_flag(const struct object *obj, int flag)
Definition: obj-util.c:670
unsigned check_for_inscrip(const struct object *obj, const char *inscrip)
Looks if "inscrip" is present on the given object.
Definition: obj-util.c:335
void distribute_charges(struct object *source, struct object *dest, int amt)
Distribute charges of rods, staves, or wands.
Definition: obj-util.c:791
Information about object kinds, including player knowledge.
Definition: object.h:165
bool item_test(item_tester tester, int item)
png_infop png_uint_32 flag
Definition: libpng12/png.h:2191
bool obj_can_refill(const struct object *obj)
Check if an object can be used to refuel other objects.
Definition: obj-util.c:596
static const char * prompt
Definition: ui-object.c:592
int number_charging(const struct object *obj)
Number of items (usually rods) charging.
Definition: obj-util.c:831
struct object_kind * objkind_byid(int kidx)
Definition: obj-util.c:380
u32b kidx
Definition: object.h:172
int tval
General object type (see TV_ macros)
Definition: object.h:174
png_bytep buf
Definition: libpng12/png.h:2815
bool obj_is_useable(const struct object *obj)
Definition: obj-util.c:691
bool obj_can_zap(const struct object *obj)
Determine if an object is zappable.
Definition: obj-util.c:561
png_uint_32 int flags
Definition: libpng12/png.h:1681
void object_flags(const struct object *obj, bitflag flags[OF_SIZE])
Obtain the flags for an item.
Definition: obj-util.c:263
bool obj_can_fire(const struct object *obj)
Definition: obj-util.c:659
int get_use_device_chance(const struct object *obj)
Returns the number of times in 1000 that @ will FAIL.
Definition: obj-util.c:750
struct effect * object_effect(const struct object *obj)
Return an object's effect.
Definition: obj-util.c:710
byte bitflag
Definition: z-bitflag.h:27
bool obj_has_charges(const struct object *obj)
Determine if an object has charges.
Definition: obj-util.c:549
bool obj_can_activate(const struct object *obj)
Determine if an object can be activated now.
Definition: obj-util.c:582
void print_custom_message(struct object *obj, const char *string, int msg_type)
Print a message from a string, customised to include details about an object.
Definition: obj-util.c:928
bool obj_has_inscrip(const struct object *obj)
Definition: obj-util.c:665
bool is_unknown(const struct object *obj)
Return true if the item is unknown (has yet to be seen by the player).
Definition: obj-util.c:312
int sval
Object sub-type.
Definition: object.h:175
bool verify_object(const char *prompt, struct object *obj)
Verify the choice of an item.
Definition: obj-util.c:885
void object_short_name(char *buf, size_t max, const char *name)
Definition: obj-util.c:477
Information about ego-items.
Definition: object.h:311
#define OF_SIZE
Definition: obj-properties.h:121
void flavor_init(void)
Prepare the "variable" part of the "k_info" array.
Definition: obj-util.c:153
bool obj_can_takeoff(const struct object *obj)
Definition: obj-util.c:647
void flavor_set_all_aware(void)
Set all flavors as aware.
Definition: obj-util.c:244
bool obj_kind_can_browse(const struct object_kind *kind)
Definition: obj-util.c:615
struct ego_item * lookup_ego_item(const char *name, int tval, int sval)
Definition: obj-util.c:421
struct object_kind * lookup_kind(int tval, int sval)
Return the object kind with the given tval and sval, or NULL.
Definition: obj-util.c:364
bool obj_can_study(const struct object *obj)
Definition: obj-util.c:639
Definition: object.h:52
void object_flags_known(const struct object *obj, bitflag flags[OF_SIZE])
Obtain the flags for an item which are known to the player.
Definition: obj-util.c:274
bool obj_needs_aim(struct object *obj)
Does the given object need to be aimed?
Definition: obj-util.c:723
Intialize random names
Definition: init.c:847
bool obj_can_fail(const struct object *o)
Can the object fail if used?
Definition: obj-util.c:737
bool obj_can_cast_from(const struct object *obj)
Definition: obj-util.c:633
int compare_items(const struct object *o1, const struct object *o2)
Sort comparator for objects -1 if o1 should be first 1 if o2 should be first 0 if it doesn't matter...
Definition: obj-util.c:516
Definition: source.h:7
int lookup_sval(int tval, const char *name)
Return the numeric sval of the object kind with the given tval and name name.
Definition: obj-util.c:451
Information about artifacts.
Definition: object.h:246
bool recharge_timeout(struct object *obj)
Allow a stack of charging objects to charge by one unit per charging object Return true if something ...
Definition: obj-util.c:856
bool obj_can_wear(const struct object *obj)
Definition: obj-util.c:653