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 object_flags(const struct object *obj, bitflag flags[OF_SIZE]);
30 void object_flags_known(const struct object *obj, bitflag flags[OF_SIZE]);
31 bool object_test(item_tester tester, const struct object *o);
32 bool item_test(item_tester tester, int item);
33 bool is_unknown(const struct object *obj);
34 unsigned check_for_inscrip(const struct object *obj, const char *inscrip);
35 struct object_kind *lookup_kind(int tval, int sval);
36 struct object_kind *objkind_byid(int kidx);
37 struct artifact *lookup_artifact_name(const char *name);
38 struct ego_item *lookup_ego_item(const char *name, int tval, int sval);
39 int lookup_sval(int tval, const char *name);
40 void object_short_name(char *buf, size_t max, const char *name);
41 int compare_items(const struct object *o1, const struct object *o2);
42 bool obj_has_charges(const struct object *obj);
43 bool obj_can_zap(const struct object *obj);
44 bool obj_is_activatable(const struct object *obj);
45 bool obj_can_activate(const struct object *obj);
46 bool obj_can_refill(const struct object *obj);
47 bool obj_can_browse(const struct object *obj);
48 bool obj_can_cast_from(const struct object *obj);
49 bool obj_can_study(const struct object *obj);
50 bool obj_can_takeoff(const struct object *obj);
51 bool obj_can_wear(const struct object *obj);
52 bool obj_can_fire(const struct object *obj);
53 bool obj_has_inscrip(const struct object *obj);
54 bool obj_has_flag(const struct object *obj, int flag);
55 bool obj_is_useable(const struct object *obj);
56 struct effect *object_effect(const struct object *obj);
57 bool obj_needs_aim(struct object *obj);
58 bool obj_can_fail(const struct object *o);
60 int get_use_device_chance(const struct object *obj);
61 void distribute_charges(struct object *source, struct object *dest, int amt);
62 int number_charging(const struct object *obj);
63 bool recharge_timeout(struct object *obj);
64 bool verify_object(const char *prompt, struct object *obj);
67 #endif /* OBJECT_UTIL_H */
bool obj_can_browse(const struct object *obj)
Definition: obj-util.c:583
bool obj_is_activatable(const struct object *obj)
Determine if an object is activatable.
Definition: obj-util.c:541
struct artifact * lookup_artifact_name(const char *name)
Return the a_idx of the artifact with the given name.
Definition: obj-util.c:360
bool object_test(item_tester tester, const struct object *o)
Apply a tester function, skipping all non-objects and gold.
Definition: obj-util.c:264
bool obj_has_flag(const struct object *obj, int flag)
Definition: obj-util.c:633
unsigned check_for_inscrip(const struct object *obj, const char *inscrip)
Looks if "inscrip" is present on the given object.
Definition: obj-util.c:303
void distribute_charges(struct object *source, struct object *dest, int amt)
Distribute charges of rods, staves, or wands.
Definition: obj-util.c:754
Information about object kinds, including player knowledge.
Definition: object.h:158
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:564
bool(* item_tester)(const struct object *)
Definition: object.h:508
static const char * prompt
Definition: ui-object.c:576
int number_charging(const struct object *obj)
Number of items (usually rods) charging.
Definition: obj-util.c:794
struct object_kind * objkind_byid(int kidx)
Definition: obj-util.c:348
u32b kidx
Definition: object.h:165
int tval
General object type (see TV_ macros)
Definition: object.h:167
png_bytep buf
Definition: libpng12/png.h:2815
bool obj_is_useable(const struct object *obj)
Definition: obj-util.c:654
bool obj_can_zap(const struct object *obj)
Determine if an object is zappable.
Definition: obj-util.c:529
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:231
bool obj_can_fire(const struct object *obj)
Definition: obj-util.c:622
int get_use_device_chance(const struct object *obj)
Returns the number of times in 1000 that @ will FAIL.
Definition: obj-util.c:713
struct effect * object_effect(const struct object *obj)
Return an object's effect.
Definition: obj-util.c:673
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:517
bool obj_can_activate(const struct object *obj)
Determine if an object can be activated now.
Definition: obj-util.c:550
bool obj_has_inscrip(const struct object *obj)
Definition: obj-util.c:628
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:280
int sval
Object sub-type.
Definition: object.h:168
bool verify_object(const char *prompt, struct object *obj)
Verify the choice of an item.
Definition: obj-util.c:848
void object_short_name(char *buf, size_t max, const char *name)
Definition: obj-util.c:445
Information about ego-items.
Definition: object.h:304
#define OF_SIZE
Definition: obj-properties.h:120
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:610
struct ego_item * lookup_ego_item(const char *name, int tval, int sval)
Definition: obj-util.c:389
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:332
bool obj_can_study(const struct object *obj)
Definition: obj-util.c:602
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:242
bool obj_needs_aim(struct object *obj)
Does the given object need to be aimed?
Definition: obj-util.c:686
Intialize random names
Definition: init.c:656
bool obj_can_fail(const struct object *o)
Can the object fail if used?
Definition: obj-util.c:700
bool obj_can_cast_from(const struct object *obj)
Definition: obj-util.c:596
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:484
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:419
Information about artifacts.
Definition: object.h:239
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:819
bool obj_can_wear(const struct object *obj)
Definition: obj-util.c:616