Angband
obj-pile.h
Go to the documentation of this file.
1 
19 #include "cave.h"
20 #include "player.h"
21 
22 #define OBJECT_LIST_SIZE 128
23 #define OBJECT_LIST_INCR 128
24 
28 typedef enum
29 {
30  OSTACK_NONE = 0x00, /* No options (this does NOT mean no stacking) */
31  OSTACK_STORE = 0x01, /* Store stacking */
32  OSTACK_PACK = 0x02, /* Inventory and home */
33  OSTACK_LIST = 0x04, /* Object list */
34  OSTACK_MONSTER = 0x08, /* Monster carrying objects */
35  OSTACK_FLOOR = 0x10, /* Floor stacking */
36  OSTACK_QUIVER = 0x20 /* Quiver */
38 
42 typedef enum
43 {
44  OFLOOR_NONE = 0x00, /* No options */
45  OFLOOR_TEST = 0x01, /* Verify item tester */
46  OFLOOR_SENSE = 0x02, /* Sensed or known items only */
47  OFLOOR_TOP = 0x04, /* Only the top item */
48  OFLOOR_VISIBLE = 0x08, /* Visible items only */
50 
51 struct object *object_new(void);
52 void object_free(struct object *obj);
53 void object_delete(struct object **obj_address);
54 void object_pile_free(struct object *obj);
55 
56 void pile_insert(struct object **pile, struct object *obj);
57 void pile_insert_end(struct object **pile, struct object *obj);
58 void pile_excise(struct object **pile, struct object *obj);
59 struct object *pile_last_item(struct object *const pile);
60 bool pile_contains(const struct object *top, const struct object *obj);
61 
62 bool object_stackable(const struct object *obj1, const struct object *obj2,
63  object_stack_t mode);
64 bool object_similar(const struct object *obj1, const struct object *obj2,
65  object_stack_t mode);
66 void object_origin_combine(struct object *obj1, const struct object *obj2);
67 void object_absorb_partial(struct object *obj1, struct object *obj2);
68 void object_absorb(struct object *obj1, struct object *obj2);
69 void object_wipe(struct object *obj);
70 void object_copy(struct object *obj1, const struct object *obj2);
71 void object_copy_amt(struct object *dest, struct object *src, int amt);
72 struct object *object_split(struct object *src, int amt);
73 struct object *floor_object_for_use(struct object *obj, int num, bool message,
74  bool *none_left);
75 bool floor_carry(struct chunk *c, int y, int x, struct object *drop,
76  bool *note);
77 void drop_near(struct chunk *c, struct object **dropped, int chance, int y,
78  int x, bool verbose);
79 void push_object(int y, int x);
80 void floor_item_charges(struct object *obj);
81 int scan_floor(struct object **items, int max_size, object_floor_t mode,
82  item_tester tester);
83 int scan_distant_floor(struct object **items, int max_size, int y, int x);
84 int scan_items(struct object **item_list, size_t item_list_max, int mode,
85  item_tester tester);
86 bool item_is_available(struct object *obj);
bool floor_carry(struct chunk *c, int y, int x, struct object *drop, bool *note)
Let the floor carry an object, deleting old ignored items if necessary.
Definition: obj-pile.c:819
struct object * pile_last_item(struct object *const pile)
Return the last item in pile 'pile'.
Definition: obj-pile.c:246
void pile_insert(struct object **pile, struct object *obj)
Insert 'obj' into the pile 'pile'.
Definition: obj-pile.c:165
object_stack_t
Modes for stacking by object_similar()
Definition: obj-pile.h:28
Definition: obj-pile.h:33
Definition: obj-pile.h:35
Definition: obj-pile.h:36
void object_wipe(struct object *obj)
Wipe an object clean.
Definition: obj-pile.c:611
void object_absorb(struct object *obj1, struct object *obj2)
Merge two stacks into one stack.
Definition: obj-pile.c:597
Definition: obj-pile.h:34
struct object * object_split(struct object *src, int amt)
Split off 'amt' items from 'src' and return.
Definition: obj-pile.c:692
int scan_distant_floor(struct object **items, int max_size, int y, int x)
Get a list of the known objects at the given location.
Definition: obj-pile.c:1174
bool(* item_tester)(const struct object *)
Definition: object.h:507
Player implementation.
Definition: cave.h:153
void object_copy(struct object *obj1, const struct object *obj2)
Prepare an object based on an existing object.
Definition: obj-pile.c:626
bool item_is_available(struct object *obj)
Check if the given item is available for the player to use.
Definition: obj-pile.c:1266
Object information, for a specific object.
Definition: object.h:393
int scan_items(struct object **item_list, size_t item_list_max, int mode, item_tester tester)
Get a list of "valid" objects.
Definition: obj-pile.c:1215
Definition: obj-pile.h:46
void floor_item_charges(struct object *obj)
Describe the charges on an item on the floor.
Definition: obj-pile.c:1113
void object_free(struct object *obj)
Free up an object.
Definition: obj-pile.c:292
int verbose
Definition: unit-test.c:12
int num
Definition: libpng12/png.h:1527
bool object_stackable(const struct object *obj1, const struct object *obj2, object_stack_t mode)
Determine if an item can "absorb" a second item.
Definition: obj-pile.c:383
bool pile_contains(const struct object *top, const struct object *obj)
Check if pile 'pile' contains object 'obj'.
Definition: obj-pile.c:266
Definition: obj-pile.h:44
bool object_similar(const struct object *obj1, const struct object *obj2, object_stack_t mode)
Return whether each stack of objects can be merged into one stack.
Definition: obj-pile.c:488
Use the roguelike command false Show damage player deals to false Always pickup items
Definition: list-options.h:22
struct object * floor_object_for_use(struct object *obj, int num, bool message, bool *none_left)
Remove an amount of an object from the floor, returning a detached object which can be used - it is a...
Definition: obj-pile.c:739
Definition: obj-pile.h:45
void pile_insert_end(struct object **pile, struct object *obj)
Insert 'obj' at the end of pile 'pile'.
Definition: obj-pile.c:186
Definition: obj-pile.h:48
object_floor_t
Modes for floor scanning by scan_floor()
Definition: obj-pile.h:42
void pile_excise(struct object **pile, struct object *obj)
Remove object 'obj' from pile 'pile'.
Definition: obj-pile.c:207
void drop_near(struct chunk *c, struct object **dropped, int chance, int y, int x, bool verbose)
Let an object fall to the ground at or near a location.
Definition: obj-pile.c:1021
Definition: obj-pile.h:32
Matters relating to the current dungeon level.
void object_pile_free(struct object *obj)
Free an entire object pile.
Definition: obj-pile.c:356
void object_absorb_partial(struct object *obj1, struct object *obj2)
Merge a smaller stack into a larger stack, leaving two uneven stacks.
Definition: obj-pile.c:583
Definition: obj-pile.h:47
void object_delete(struct object **obj_address)
Delete an object and free its memory, and set its pointer to NULL.
Definition: obj-pile.c:303
Definition: obj-pile.h:31
void object_copy_amt(struct object *dest, struct object *src, int amt)
Prepare an object dst representing amt objects, based on an existing object src representing at least...
Definition: obj-pile.c:656
int scan_floor(struct object **items, int max_size, object_floor_t mode, item_tester tester)
Get a list of the objects at the player's location.
Definition: obj-pile.c:1133
struct object * object_new(void)
Create a new object and return it.
Definition: obj-pile.c:282
Definition: obj-pile.h:30
void note(const char *message)
Utility
Definition: savefile.c:177
void object_origin_combine(struct object *obj1, const struct object *obj2)
Combine the origins of two objects.
Definition: obj-pile.c:503
void push_object(int y, int x)
This will push objects off a square.
Definition: obj-pile.c:1060