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 "datafile.h"
26 #include "object.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  struct object *stock_k; /* Stock -- Stock as known by the character */
68 
69  /* Always stock these items */
70  size_t always_size;
71  size_t always_num;
73 
74  /* Select a number of these items to stock */
75  size_t normal_size;
76  size_t normal_num;
78 
79  /* Buy these items */
80  struct object_buy *buy;
81 
82  int turnover;
85 };
86 
87 extern struct store *stores;
88 
89 struct store *store_at(struct chunk *c, int y, int x);
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);
100 
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);
104 
105 extern struct owner *store_ownerbyidx(struct store *s, unsigned int idx);
106 
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);
110 
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);
115 
116 #endif /* INCLUDED_STORE_H */
struct owner * store_ownerbyidx(struct store *s, unsigned int idx)
Owner stuff.
Definition: store.c:1368
Definition: store.h:44
struct object_kind ** always_table
Definition: store.h:72
Definition: store.h:36
int normal_stock_max
Definition: store.h:84
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:1681
Definition: store.h:34
Information about object kinds, including player knowledge.
Definition: object.h:158
size_t always_num
Definition: store.h:71
void store_update(void)
Update the stores on the return to town.
Definition: store.c:1332
struct store * stores
Constants and definitions
Definition: store.c:57
The struct command type is used to return details of the command the game should carry out...
Definition: cmd-core.h:188
Definition: store.h:38
void store_stock_list(struct store *store, struct object **list, int n)
Sort the store inventory into an ordered array.
Definition: store.c:723
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:560
struct owner * next
Definition: store.h:52
void do_cmd_stash(struct command *cmd)
Stash an item in the home.
Definition: store.c:1884
struct store * store_at(struct chunk *c, int y, int x)
Return the store instance at the given location.
Definition: store.c:76
struct object * stock_k
Definition: store.h:67
uint8_t byte
Definition: h-basic.h:167
void store_shuffle(struct store *store)
Shuffle one of the stores.
Definition: store.c:1394
Definition: store.h:33
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:786
void home_carry(struct object *obj)
Add an object to the inventory of the Home.
Definition: store.c:820
Definition: cave.h:147
int find_inven(const struct object *obj)
Higher-level code
Definition: store.c:1416
struct object * store_carry(struct store *store, struct object *obj)
Add an object to a real stores inventory.
Definition: store.c:857
Object information, for a specific object.
Definition: object.h:394
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:1743
struct parser * init_parse_stores(void)
Definition: store.c:272
Definition: store.h:32
Definition: store.h:50
Definition: store.h:35
void do_cmd_sell(struct command *cmd)
Sell an item to the current store.
Definition: store.c:1765
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:40
int16_t s16b
Definition: h-basic.h:170
int turnover
Definition: store.h:82
struct object * stock
Definition: store.h:66
int normal_stock_min
Definition: store.h:83
char * name
Definition: store.h:53
byte stock_num
Definition: store.h:64
Definition: store.h:37
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:39
Definition: store.h:57
s32b max_cost
Definition: store.h:54
int32_t s32b
Definition: h-basic.h:173
struct parser * store_parser_new(void)
s16b stock_size
Definition: store.h:65
void store_init(void)
Definition: store.c:331
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:1551
size_t flag
Definition: store.h:47
void store_reset(void)
Definition: store.c:338
struct store * next
Definition: store.h:58
Data file writing routines.
struct object_buy * next
Definition: store.h:45
Definition: store.h:41
size_t normal_size
Definition: store.h:75
size_t tval
Definition: store.h:46
size_t normal_num
Definition: store.h:76