1 /** 2 * \file obj-pile.h 3 * \brief Deal with piles of objects 4 * 5 * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke 6 * 7 * This work is free software; you can redistribute it and/or modify it 8 * under the terms of either: 9 * 10 * a) the GNU General Public License as published by the Free Software 11 * Foundation, version 2, or 12 * 13 * b) the "Angband licence": 14 * This software may be copied and distributed for educational, research, 15 * and not for profit purposes provided that this copyright and statement 16 * are included in all such copies. Other copyrights may also apply. 17 */ 18 19 #include "cave.h" 20 #include "player.h" 21 22 #define OBJECT_LIST_SIZE 128 23 #define OBJECT_LIST_INCR 128 24 25 /** 26 * Modes for stacking by object_similar() 27 */ 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 */ 37 } object_stack_t; 38 39 /** 40 * Modes for floor scanning by scan_floor() 41 */ 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 */ 49 } object_floor_t; 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, struct loc grid, struct object *drop, 76 bool *note); 77 void drop_near(struct chunk *c, struct object **dropped, int chance, 78 struct loc grid, bool verbose, bool prefer_pile); 79 void push_object(struct loc grid); 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, struct loc grid); 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); 87