Angband
obj-util.h
Go to the documentation of this file.
1 
19 #ifndef OBJECT_UTIL_H
20 #define OBJECT_UTIL_H
21 
22 /* Maximum number of scroll titles generated */
23 #define MAX_TITLES 50
24 
25 /* An item's pval (for charges, amount of gold, etc) is limited to s16b */
26 #define MAX_PVAL 32767
27 
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);
59 
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);
65 
66 
67 #endif /* OBJECT_UTIL_H */
bool obj_can_browse(const struct object *obj)
Definition: obj-util.c:597
bool obj_is_activatable(const struct object *obj)
Determine if an object is activatable.
Definition: obj-util.c:555
struct artifact * lookup_artifact_name(const char *name)
Return the a_idx of the artifact with the given name.
Definition: obj-util.c:374
bool object_test(item_tester tester, const struct object *o)
Apply a tester function, skipping all non-objects and gold.
Definition: obj-util.c:278
bool obj_has_flag(const struct object *obj, int flag)
Definition: obj-util.c:647
unsigned check_for_inscrip(const struct object *obj, const char *inscrip)
Looks if "inscrip" is present on the given object.
Definition: obj-util.c:317
void distribute_charges(struct object *source, struct object *dest, int amt)
Distribute charges of rods, staves, or wands.
Definition: obj-util.c:768
Information about object kinds, including player knowledge.
Definition: object.h:157
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:578
bool(* item_tester)(const struct object *)
Definition: object.h:507
static const char * prompt
Definition: ui-object.c:574
int number_charging(const struct object *obj)
Number of items (usually rods) charging.
Definition: obj-util.c:808
struct object_kind * objkind_byid(int kidx)
Definition: obj-util.c:362
u32b kidx
Definition: object.h:164
int tval
General object type (see TV_ macros)
Definition: object.h:166
png_bytep buf
Definition: libpng12/png.h:2815
bool obj_is_useable(const struct object *obj)
Definition: obj-util.c:668
bool obj_can_zap(const struct object *obj)
Determine if an object is zappable.
Definition: obj-util.c:543
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:245
bool obj_can_fire(const struct object *obj)
Definition: obj-util.c:636
int get_use_device_chance(const struct object *obj)
Returns the number of times in 1000 that @ will FAIL.
Definition: obj-util.c:727
struct effect * object_effect(const struct object *obj)
Return an object's effect.
Definition: obj-util.c:687
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:531
bool obj_can_activate(const struct object *obj)
Determine if an object can be activated now.
Definition: obj-util.c:564
bool obj_has_inscrip(const struct object *obj)
Definition: obj-util.c:642
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:294
int sval
Object sub-type.
Definition: object.h:167
bool verify_object(const char *prompt, struct object *obj)
Verify the choice of an item.
Definition: obj-util.c:862
void object_short_name(char *buf, size_t max, const char *name)
Definition: obj-util.c:459
Information about ego-items.
Definition: object.h:303
#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:624
struct ego_item * lookup_ego_item(const char *name, int tval, int sval)
Definition: obj-util.c:403
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:346
bool obj_can_study(const struct object *obj)
Definition: obj-util.c:616
Effect.
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:256
bool obj_needs_aim(struct object *obj)
Does the given object need to be aimed?
Definition: obj-util.c:700
Intialize random names
Definition: init.c:664
bool obj_can_fail(const struct object *o)
Can the object fail if used?
Definition: obj-util.c:714
bool obj_can_cast_from(const struct object *obj)
Definition: obj-util.c:610
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:498
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:433
Information about artifacts.
Definition: object.h:238
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:833
bool obj_can_wear(const struct object *obj)
Definition: obj-util.c:630