Angband
Data Structures | Enumerations | Functions | Variables
store.h File Reference

Store stocking. More...

#include "cave.h"
#include "cmd-core.h"
#include "object.h"
#include "parser.h"

Go to the source code of this file.

Data Structures

struct  object_buy
struct  owner
struct  store

Enumerations

enum  {
  STORE_NONE = -1, STORE_GENERAL = 0, STORE_ARMOR = 1, STORE_WEAPON = 2,
  STORE_TEMPLE = 3, STORE_ALCHEMY = 4, STORE_MAGIC = 5, STORE_B_MARKET = 6,
  STORE_HOME = 7, MAX_STORES = 8
}
 List of store indices. More...

Functions

struct storestore_at (struct chunk *c, int y, int x)
 Return the store instance at the given location.
void store_init (void)
void free_stores (void)
void store_stock_list (struct store *store, struct object **list, int n)
 Sort the store inventory into an ordered array.
struct objectstore_carry (struct store *store, struct object *obj)
 Add an object to a real stores inventory.
void store_reset (void)
void store_shuffle (struct store *store)
 Shuffle one of the stores.
void store_update (void)
 Update the stores on the return to town.
int price_item (struct store *store, const object_type *o_ptr, bool store_buying, int qty)
bool store_will_buy_tester (const struct object *obj)
 Determine if the current store will purchase the given object.
bool store_check_num (struct store *store, const struct object *obj)
 Check to see if the shop will be carrying too many objects.
int find_inven (const struct object *obj)
 

Higher-level code


struct ownerstore_ownerbyidx (struct store *s, unsigned int idx)
 Owner stuff.
struct parserinit_parse_stores (void)
struct parserstore_parser_new (void)
struct parserstore_owner_parser_new (struct store *stores)
void do_cmd_sell (struct command *cmd)
 Sell an item to the current store.
void do_cmd_stash (struct command *cmd)
 Stash an item in the home.
void do_cmd_buy (struct command *cmd)
 Buy the item with the given index from the current store's inventory.
void do_cmd_retrieve (struct command *cmd)
 Retrieve the item with the given index from the home's inventory.

Variables

struct storestores
 

Constants and definitions


Detailed Description

Store stocking.

Copyright (c) 1997 Robert A. Koeneke, James E. Wilson, Ben Harrison Copyright (c) 2007 Andi Sidwell

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Enumeration Type Documentation

anonymous enum

List of store indices.

Enumerator:
STORE_NONE 
STORE_GENERAL 
STORE_ARMOR 
STORE_WEAPON 
STORE_TEMPLE 
STORE_ALCHEMY 
STORE_MAGIC 
STORE_B_MARKET 
STORE_HOME 
MAX_STORES 

Function Documentation

void do_cmd_buy ( struct command cmd)
void do_cmd_retrieve ( struct command cmd)
void do_cmd_sell ( struct command cmd)
void do_cmd_stash ( struct command cmd)
int find_inven ( const struct object obj)
void free_stores ( void  )
struct parser* init_parse_stores ( void  )
read
int price_item ( struct store store,
const object_type o_ptr,
bool  store_buying,
int  qty 
)
struct store* store_at ( struct chunk c,
int  y,
int  x 
)
read
struct object* store_carry ( struct store store,
struct object obj 
)
read

Add an object to a real stores inventory.

If the object is "worthless", it is thrown away (except in the home).

If the object cannot be combined with an object already in the inventory, make a new slot for it, and calculate its "per item" price. Note that this price will be negative, since the price will not be "fixed" yet. Adding an object to a "fixed" price stack will not change the fixed price.

Returns the object inserted (for ease of use) or NULL if it disappears

References object_kind::charge, angband_constants::default_lamp, FALSE, object::flags, angband_constants::fuel_torch, i, object::kind, object::next, object::note, object::number, object_similar(), object_value(), of_has, OSTACK_STORE, pile_insert(), object::pval, randcalc(), RANDOMISE, store::stock, store::stock_num, store::stock_size, store_can_carry(), store_object_absorb(), object::timeout, tval_can_have_charges(), tval_can_have_timeout(), tval_is_light(), value, and z_info.

Referenced by do_cmd_sell(), rd_stores_aux(), store_create_item(), and store_create_random().

bool store_check_num ( struct store store,
const struct object obj 
)

Check to see if the shop will be carrying too many objects.

Note that the shop, just like a player, will not accept things it cannot hold. Before, one could "nuke" objects this way, by adding them to a pile which was already full.

References FALSE, object::next, object_similar(), OSTACK_PACK, OSTACK_STORE, store::sidx, store::stock, store::stock_num, store::stock_size, STORE_HOME, and TRUE.

Referenced by do_cmd_sell(), do_cmd_stash(), and store_sell().

void store_init ( void  )
struct parser* store_owner_parser_new ( struct store stores)
read
struct owner* store_ownerbyidx ( struct store s,
unsigned int  idx 
)
read

Owner stuff.

References owner::next, owner::oidx, store::owners, and quit_fmt().

Referenced by rd_stores_aux(), and store_choose_owner().

struct parser* store_parser_new ( void  )
read
void store_reset ( void  )
void store_shuffle ( struct store store)

Shuffle one of the stores.

References store::owner, and store_choose_owner().

Referenced by do_cmd_buy(), store_reset(), and store_update().

void store_stock_list ( struct store store,
struct object **  list,
int  n 
)

Sort the store inventory into an ordered array.

References earlier_object(), FALSE, i, object::next, num, store::sidx, store::stock, STORE_HOME, and TRUE.

Referenced by refresh_stock(), and store_menu_init().

void store_update ( void  )

Update the stores on the return to town.

References daycount, MAX_STORES, msg, one_in_, OPT, randint0, STORE_HOME, store_maint(), angband_constants::store_shuffle, store_shuffle(), and z_info.

Referenced by dungeon_change_level().

bool store_will_buy_tester ( const struct object obj)

Determine if the current store will purchase the given object.

References cave, FALSE, object::kind, object_is_known(), OPT, player::px, player::py, store_at(), store_can_carry(), store_will_buy(), and tval_can_have_charges().

Referenced by store_sell().

Variable Documentation

struct store* stores


Constants and definitions

Array[MAX_STORES] of stores

Referenced by death_info(), death_knowledge(), find_artifact(), flatten_stores(), rd_stores_aux(), textui_store_knowledge(), wr_stores(), and write_character_dump().