Angband
store.h
Go to the documentation of this file.
1 
20 #ifndef INCLUDED_STORE_H
21 #define INCLUDED_STORE_H
22 
23 #include "cave.h"
24 #include "cmd-core.h"
25 #include "object.h"
26 #include "parser.h"
27 
31 enum {
32  STORE_NONE = -1,
42 };
43 
44 struct object_buy {
45  struct object_buy *next;
46  size_t tval;
47  size_t flag;
48 };
49 
50 struct owner {
51  unsigned int oidx;
52  struct owner *next;
53  char *name;
55 };
56 
57 struct store {
58  struct store *next;
59  struct owner *owners;
60  struct owner *owner;
61  unsigned int sidx;
62  const char *name;
63 
64  byte stock_num; /* Stock -- Number of entries */
65  s16b stock_size; /* Stock -- Total Size of Array */
66  struct object *stock; /* Stock -- Actual stock items */
67 
68  /* Always stock these items */
69  size_t always_size;
70  size_t always_num;
72 
73  /* Select a number of these items to stock */
74  size_t normal_size;
75  size_t normal_num;
77 
78  /* Buy these items */
79  struct object_buy *buy;
80 
81  int turnover;
84 };
85 
86 extern struct store *stores;
87 
88 struct store *store_at(struct chunk *c, int y, int x);
89 void store_init(void);
90 void free_stores(void);
91 void store_stock_list(struct store *store, struct object **list, int n);
92 struct object *store_carry(struct store *store, struct object *obj);
93 void store_reset(void);
94 void store_shuffle(struct store *store);
95 void store_update(void);
96 int price_item(struct store *store, const object_type *o_ptr, bool store_buying, int qty);
97 
98 bool store_will_buy_tester(const struct object *obj);
99 bool store_check_num(struct store *store, const struct object *obj);
100 int find_inven(const struct object *obj);
101 
102 extern struct owner *store_ownerbyidx(struct store *s, unsigned int idx);
103 
104 struct parser *init_parse_stores(void);
105 extern struct parser *store_parser_new(void);
106 extern struct parser *store_owner_parser_new(struct store *stores);
107 
108 extern void do_cmd_sell(struct command *cmd);
109 extern void do_cmd_stash(struct command *cmd);
110 extern void do_cmd_buy(struct command *cmd);
111 extern void do_cmd_retrieve(struct command *cmd);
112 
113 #endif /* INCLUDED_STORE_H */