Go to the documentation of this file.
23 #include "cave.h"
24 #include "cmd-core.h"
25 #include "datafile.h"
26 #include "object.h"
31 enum {
32  STORE_NONE = -1,
42 };
44 struct object_buy {
45  struct object_buy *next;
46  size_t tval;
47  size_t flag;
48 };
50 struct owner {
51  unsigned int oidx;
52  struct owner *next;
53  char *name;
55 };
57 struct store {
58  struct store *next;
59  struct owner *owners;
60  struct owner *owner;
61  unsigned int sidx;
62  const char *name;
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  struct object *stock_k; /* Stock -- Stock as known by the character */
69  /* Always stock these items */
70  size_t always_size;
71  size_t always_num;
74  /* Select a number of these items to stock */
75  size_t normal_size;
76  size_t normal_num;
79  /* Buy these items */
80  struct object_buy *buy;
82  int turnover;
85 };
87 extern struct store *stores;
89 struct store *store_at(struct chunk *c, struct loc grid);
90 void store_init(void);
91 void free_stores(void);
92 void store_stock_list(struct store *store, struct object **list, int n);
93 void home_carry(struct object *obj);
94 struct object *store_carry(struct store *store, struct object *obj);
95 void store_reset(void);
96 void store_shuffle(struct store *store);
97 void store_update(void);
98 int price_item(struct store *store, const struct object *obj,
99  bool store_buying, int qty);
101 bool store_will_buy_tester(const struct object *obj);
102 bool store_check_num(struct store *store, const struct object *obj);
103 int find_inven(const struct object *obj);
105 extern struct owner *store_ownerbyidx(struct store *s, unsigned int idx);
107 struct parser *init_parse_stores(void);
108 extern struct parser *store_parser_new(void);
109 extern struct parser *store_owner_parser_new(struct store *stores);
111 extern void do_cmd_sell(struct command *cmd);
112 extern void do_cmd_stash(struct command *cmd);
113 extern void do_cmd_buy(struct command *cmd);
114 extern void do_cmd_retrieve(struct command *cmd);
116 #endif /* INCLUDED_STORE_H */
struct owner * store_ownerbyidx(struct store *s, unsigned int idx)
Owner stuff.
Definition: store.c:1438
Definition: store.h:44
struct object_kind ** always_table
Definition: store.h:72
int normal_stock_max
Definition: store.h:84
Definition: store.h:35
Definition: store.h:41
void free_stores(void)
void do_cmd_retrieve(struct command *cmd)
Retrieve the item with the given index from the home's inventory.
Definition: store.c:1751
Definition: z-type.h:24
Information about object kinds, including player knowledge.
Definition: object.h:182
size_t always_num
Definition: store.h:71
void store_update(void)
Update the stores on the return to town.
Definition: store.c:1402
struct store * stores
Constants and definitions
Definition: store.c:58
The struct command type is used to return details of the command the game should carry out...
Definition: cmd-core.h:176
void store_stock_list(struct store *store, struct object **list, int n)
Sort the store inventory into an ordered array.
Definition: store.c:781
struct object_kind ** normal_table
Definition: store.h:77
int price_item(struct store *store, const struct object *obj, bool store_buying, int qty)
Basics: pricing, generation, etc.
Definition: store.c:593
struct owner * next
Definition: store.h:52
void do_cmd_stash(struct command *cmd)
Stash an item in the home.
Definition: store.c:1961
struct object * stock_k
Definition: store.h:67
uint8_t byte
Definition: h-basic.h:159
void store_shuffle(struct store *store)
Shuffle one of the stores.
Definition: store.c:1464
bool store_check_num(struct store *store, const struct object *obj)
Check to see if the shop will be carrying too many objects.
Definition: store.c:844
void home_carry(struct object *obj)
Add an object to the inventory of the Home.
Definition: store.c:878
Definition: cave.h:180
int find_inven(const struct object *obj)
Higher-level code
Definition: store.c:1486
struct object * store_carry(struct store *store, struct object *obj)
Add an object to a real stores inventory.
Definition: store.c:915
Object information, for a specific object.
Definition: object.h:418
unsigned int sidx
Definition: store.h:61
bool store_will_buy_tester(const struct object *obj)
Determine if the current store will purchase the given object.
Definition: store.c:1814
struct parser * init_parse_stores(void)
Definition: store.c:301
Definition: store.h:50
void do_cmd_sell(struct command *cmd)
Sell an item to the current store.
Definition: store.c:1825
Handles the queueing of game commands.
struct parser * store_owner_parser_new(struct store *stores)
struct owner * owners
Definition: store.h:59
struct owner * owner
Definition: store.h:60
Definition: store.h:32
Definition: store.h:37
int16_t s16b
Definition: h-basic.h:162
Definition: store.h:40
Definition: store.h:39
int turnover
Definition: store.h:82
struct object * stock
Definition: store.h:66
Definition: store.h:34
int normal_stock_min
Definition: store.h:83
char * name
Definition: store.h:53
byte stock_num
Definition: store.h:64
struct object_buy * buy
Definition: store.h:80
basic object structs and enums
const char * name
Definition: store.h:62
Matters relating to the current dungeon level.
unsigned int oidx
Definition: store.h:51
Definition: store.h:57
s32b max_cost
Definition: store.h:54
int32_t s32b
Definition: h-basic.h:165
struct parser * store_parser_new(void)
s16b stock_size
Definition: store.h:65
void store_init(void)
Definition: store.c:360
size_t always_size
Definition: store.h:70
Definition: parser.c:74
void do_cmd_buy(struct command *cmd)
Buy the item with the given index from the current store's inventory.
Definition: store.c:1621
size_t flag
Definition: store.h:47
struct store * store_at(struct chunk *c, struct loc grid)
Return the store instance at the given location.
Definition: store.c:77
void store_reset(void)
Definition: store.c:367
struct store * next
Definition: store.h:58
Data file writing routines.
Definition: store.h:33
struct object_buy * next
Definition: store.h:45
Definition: store.h:38
size_t normal_size
Definition: store.h:75
Definition: store.h:36
size_t tval
Definition: store.h:46
size_t normal_num
Definition: store.h:76