Apply the new ground_level method.
[crawl.git] / crawl-ref / source / items.h
blob9163e58a1f6d7ca488c5879a76cd7b868741c136
1 /*
2 * File: items.h
3 * Summary: Misc (mostly) inventory related functions.
4 * Written by: Linley Henzell
5 */
8 #ifndef ITEMS_H
9 #define ITEMS_H
11 #include "externs.h"
13 // Ways to get items, other than finding them on the ground or looting them
14 // from slain monsters.
15 enum item_source_type
17 IT_SRC_NONE = 0,
19 // Empty space for the gods
21 AQ_SCROLL = 100,
22 AQ_CARD_GENIE,
23 IT_SRC_START,
24 IT_SRC_SHOP,
26 // Empty space for new non-wizmode acquisition methods
28 AQ_WIZMODE = 200,
31 int get_max_subtype(object_class_type base_type);
33 bool dec_inv_item_quantity(int obj, int amount, bool suppress_burden = false);
34 bool dec_mitm_item_quantity(int obj, int amount);
36 void inc_inv_item_quantity(int obj, int amount, bool suppress_burden = false);
37 void inc_mitm_item_quantity(int obj, int amount);
39 bool move_item_to_grid(int *const obj, const coord_def& p,
40 bool silent = false);
41 void move_item_stack_to_grid(const coord_def& from, const coord_def& to);
42 void note_inscribe_item(item_def &item);
43 int move_item_to_player(int obj, int quant_got, bool quiet = false,
44 bool ignore_burden = false);
45 void mark_items_non_pickup_at(const coord_def &pos);
46 bool is_stackable_item(const item_def &item);
47 bool items_similar(const item_def &item1, const item_def &item2,
48 bool ignore_ident = false);
49 bool items_stack(const item_def &item1, const item_def &item2,
50 bool force_merge = false, bool ignore_ident = false);
51 void merge_item_stacks(item_def &source, item_def &dest,
52 int quant = -1);
54 item_def find_item_type(object_class_type base_type, std::string name);
55 item_def *find_floor_item(object_class_type cls, int sub_type);
56 int item_on_floor(const item_def &item, const coord_def& where);
58 void init_item(int item);
60 void link_items(void);
62 void fix_item_coordinates(void);
64 int get_item_slot(int reserve = 50);
66 void unlink_item(int dest);
67 void destroy_item(item_def &item, bool never_created = false);
68 void destroy_item(int dest, bool never_created = false);
69 void lose_item_stack(const coord_def& where);
71 void item_check(bool verbose);
72 void request_autopickup(bool do_pickup = true);
74 bool player_on_single_stack();
75 void pickup_menu(int item_link);
76 void pickup(bool partial_quantity = false);
78 bool item_is_branded(const item_def& item);
79 int item_name_specialness(const item_def& item);
80 void item_list_on_square(std::vector<const item_def*>& items,
81 int obj, bool force_squelch = false);
83 bool copy_item_to_grid(const item_def &item, const coord_def& p,
84 int quant_drop = -1, // item.quantity by default
85 bool mark_dropped = false,
86 bool silent = false);
88 bool move_top_item(const coord_def &src, const coord_def &dest);
90 // Get the top item in a given cell. If allow_mimic_item is true and
91 // an unknown mimic is inhabiting the square, get that mimic's item.
92 // If there are no items, return NULL.
93 const item_def* top_item_at(const coord_def& where, bool allow_mimic_item);
94 item_def *corpse_at(coord_def pos, int *num_corpses = NULL);
96 // Returns whether there is more than one item in a given cell.
97 bool multiple_items_at(const coord_def& where, bool allow_mimic_item);
99 void drop(void);
101 int inv_count(void);
103 bool pickup_single_item(int link, int qty);
105 bool drop_item(int item_dropped, int quant_drop);
107 int get_equip_slot(const item_def *item);
108 mon_inv_type get_mon_equip_slot(const monster* mon, const item_def &item);
110 void origin_reset(item_def &item);
111 void origin_set(const coord_def& where);
112 void origin_set_monster(item_def &item, const monster* mons);
113 bool origin_known(const item_def &item);
114 bool origin_describable(const item_def &item);
115 std::string origin_desc(const item_def &item);
116 void origin_purchased(item_def &item);
117 void origin_acquired(item_def &item, int agent);
118 void origin_set_startequip(item_def &item);
119 void origin_set_unknown(item_def &item);
120 void origin_set_inventory(void (*oset)(item_def &item));
121 bool origin_is_god_gift(const item_def& item, god_type *god = NULL);
122 bool origin_is_acquirement(const item_def& item,
123 item_source_type *type = NULL);
124 std::string origin_monster_name(const item_def &item);
126 bool item_needs_autopickup(const item_def &);
127 bool can_autopickup();
129 bool need_to_autopickup();
130 void autopickup();
132 int find_free_slot(const item_def &i);
134 bool need_to_autoinscribe();
135 void request_autoinscribe(bool do_inscribe = true);
136 void autoinscribe();
138 bool item_is_equipped(const item_def &item, bool quiver_too = false);
139 bool item_is_melded(const item_def& item);
140 equipment_type item_equip_slot(const item_def &item);
142 void item_was_lost(const item_def &item);
143 void item_was_destroyed(const item_def &item, int cause = -1);
145 bool get_item_by_name(item_def *item, char* specs,
146 object_class_type class_wanted,
147 bool create_for_real = false);
149 void move_items(const coord_def r, const coord_def p);
150 // Returns the Orb's position on the ground, or origin()
151 coord_def orb_position();
153 #endif