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, bool last);
76 void drop_near(struct chunk *c, struct object **dropped, int chance, int y,
77  int x, bool verbose);
78 void push_object(int y, int x);
79 void floor_item_charges(struct object *obj);
80 int scan_floor(struct object **items, int max_size, object_floor_t mode,
81  item_tester tester);
82 int scan_distant_floor(struct object **items, int max_size, int y, int x);
83 int scan_items(struct object **item_list, size_t item_list_max, int mode,
84  item_tester tester);
85 bool item_is_available(struct object *obj);
struct object * pile_last_item(struct object *const pile)
Return the last item in pile 'pile'.
Definition: obj-pile.c:164
void pile_insert(struct object **pile, struct object *obj)
Insert 'obj' into the pile 'pile'.
Definition: obj-pile.c:92
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:529
void object_absorb(struct object *obj1, struct object *obj2)
Merge two stacks into one stack.
Definition: obj-pile.c:515
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:610
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:1085
bool(* item_tester)(const struct object *)
Definition: object.h:507
Player implementation.
Definition: cave.h:142
void object_copy(struct object *obj1, const struct object *obj2)
Prepare an object based on an existing object.
Definition: obj-pile.c:544
bool item_is_available(struct object *obj)
Check if the given item is available for the player to use.
Definition: obj-pile.c:1177
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:1126
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:1024
void object_free(struct object *obj)
Free up an object.
Definition: obj-pile.c:210
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:301
bool pile_contains(const struct object *top, const struct object *obj)
Check if pile 'pile' contains object 'obj'.
Definition: obj-pile.c:184
Definition: obj-pile.h:44
bool floor_carry(struct chunk *c, int y, int x, struct object *drop, bool last)
Let the floor carry an object, deleting old ignored items if necessary.
Definition: obj-pile.c:737
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:406
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:657
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:112
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:131
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:931
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:274
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:501
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:221
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:574
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:1044
struct object * object_new(void)
Create a new object and return it.
Definition: obj-pile.c:200
Definition: obj-pile.h:30
void object_origin_combine(struct object *obj1, const struct object *obj2)
Combine the origins of two objects.
Definition: obj-pile.c:421
void push_object(int y, int x)
This will push objects off a square.
Definition: obj-pile.c:971