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 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 unsigned check_for_inscrip_with_int(const struct object *obj, const char *insrip, int *ival);
37 struct object_kind *lookup_kind(int tval, int sval);
38 struct object_kind *objkind_byid(int kidx);
39 struct artifact *lookup_artifact_name(const char *name);
40 struct ego_item *lookup_ego_item(const char *name, int tval, int sval);
41 int lookup_sval(int tval, const char *name);
42 void object_short_name(char *buf, size_t max, const char *name);
43 int compare_items(const struct object *o1, const struct object *o2);
44 bool obj_has_charges(const struct object *obj);
45 bool obj_can_zap(const struct object *obj);
46 bool obj_is_activatable(const struct object *obj);
47 bool obj_can_activate(const struct object *obj);
48 bool obj_can_refill(const struct object *obj);
49 bool obj_kind_can_browse(const struct object_kind *kind);
50 bool obj_can_browse(const struct object *obj);
51 bool obj_can_cast_from(const struct object *obj);
52 bool obj_can_study(const struct object *obj);
53 bool obj_can_takeoff(const struct object *obj);
54 bool obj_can_wear(const struct object *obj);
55 bool obj_can_fire(const struct object *obj);
56 bool obj_is_throwing(const struct object *obj);
57 bool obj_has_inscrip(const struct object *obj);
58 bool obj_has_flag(const struct object *obj, int flag);
59 bool obj_is_useable(const struct object *obj);
60 struct effect *object_effect(const struct object *obj);
61 bool obj_needs_aim(struct object *obj);
62 bool obj_can_fail(const struct object *o);
63 
64 int get_use_device_chance(const struct object *obj);
65 void distribute_charges(struct object *source, struct object *dest, int amt);
66 int number_charging(const struct object *obj);
67 bool recharge_timeout(struct object *obj);
68 bool verify_object(const char *prompt, struct object *obj);
69 void print_custom_message(struct object *obj, const char *string, int msg_type);
70 
71 
72 #endif /* OBJECT_UTIL_H */
bool(* item_tester)(const struct object *)
Definition: object.h:530
bool obj_can_browse(const struct object *obj)
Definition: obj-util.c:665
bool obj_is_activatable(const struct object *obj)
Determine if an object is activatable.
Definition: obj-util.c:611
struct artifact * lookup_artifact_name(const char *name)
Return the a_idx of the artifact with the given name.
Definition: obj-util.c:430
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:715
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:836
Information about object kinds, including player knowledge.
Definition: object.h:182
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:633
static const char * prompt
Definition: ui-object.c:591
int number_charging(const struct object *obj)
Number of items (usually rods) charging.
Definition: obj-util.c:876
struct object_kind * objkind_byid(int kidx)
Definition: obj-util.c:418
u32b kidx
Definition: object.h:189
int tval
General object type (see TV_ macros)
Definition: object.h:191
png_bytep buf
Definition: libpng12/png.h:2815
bool obj_is_useable(const struct object *obj)
Definition: obj-util.c:736
bool obj_can_zap(const struct object *obj)
Determine if an object is zappable.
Definition: obj-util.c:599
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:696
int get_use_device_chance(const struct object *obj)
Returns the number of times in 1000 that @ will FAIL.
Definition: obj-util.c:795
struct effect * object_effect(const struct object *obj)
Return an object's effect.
Definition: obj-util.c:755
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:587
bool obj_can_activate(const struct object *obj)
Determine if an object can be activated now.
Definition: obj-util.c:620
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:973
bool obj_is_throwing(const struct object *obj)
Determine if an object is designed for throwing.
Definition: obj-util.c:704
bool obj_has_inscrip(const struct object *obj)
Definition: obj-util.c:710
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:192
bool verify_object(const char *prompt, struct object *obj)
Verify the choice of an item.
Definition: obj-util.c:930
void object_short_name(char *buf, size_t max, const char *name)
Definition: obj-util.c:515
unsigned check_for_inscrip_with_int(const struct object *obj, const char *insrip, int *ival)
Looks if "inscrip" immediately followed by a decimal integer without a leading sign character is pres...
Definition: obj-util.c:366
Information about ego-items.
Definition: object.h:328
#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:684
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:652
struct ego_item * lookup_ego_item(const char *name, int tval, int sval)
Definition: obj-util.c:459
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:402
bool obj_can_study(const struct object *obj)
Definition: obj-util.c:676
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:274
bool obj_needs_aim(struct object *obj)
Does the given object need to be aimed?
Definition: obj-util.c:768
Intialize random names
Definition: init.c:1084
bool obj_can_fail(const struct object *o)
Can the object fail if used?
Definition: obj-util.c:782
bool obj_can_cast_from(const struct object *obj)
Definition: obj-util.c:670
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:554
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:489
Information about artifacts.
Definition: object.h:263
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:901
bool obj_can_wear(const struct object *obj)
Definition: obj-util.c:690