Crossfire Server, Branch 1.12
R12190
|
Implementation of the shop inventory class of objects. More...
#include <global.h>
#include <ob_methods.h>
#include <ob_types.h>
#include <sounds.h>
#include <sproto.h>
Go to the source code of this file.
Data Structures | |
struct | shopinv |
One item to list on the sign. More... | |
Typedefs | |
typedef struct shopinv | shopinv |
One item to list on the sign. | |
Functions | |
static void | add_shop_item (object *tmp, shopinv *items, size_t *numitems) |
Insert the item in the list. | |
void | init_type_shop_inventory (void) |
Initializer for the SHOP_INVENTORY object type. | |
static method_ret | shop_inventory_type_apply (ob_methods *context, object *lighter, object *applier, int aflags) |
Apply a shop inventory. | |
static int | shop_sort (const void *a1, const void *a2) |
Sort routine for shopinv. |
Implementation of the shop inventory class of objects.
Definition in file shop_inventory.c.
static void add_shop_item | ( | object * | tmp, |
shopinv * | items, | ||
size_t * | numitems | ||
) | [static] |
Insert the item in the list.
tmp | object to insert. Must have FLAG_UNPAID set. |
items | array of items, should have (*numitems)+1 items allocated. |
numitems | how many items items contains. |
Definition at line 87 of file shop_inventory.c.
References CLEAR_FLAG, FLAG_UNPAID, shopinv::item_real, shopinv::item_sort, MAX_BUF, shopinv::nrof, query_base_name(), SET_FLAG, strdup_local(), and shopinv::type.
Referenced by shop_inventory_type_apply().
void init_type_shop_inventory | ( | void | ) |
Initializer for the SHOP_INVENTORY object type.
Definition at line 38 of file shop_inventory.c.
References register_apply(), SHOP_INVENTORY, and shop_inventory_type_apply().
Referenced by register_all_ob_types().
static method_ret shop_inventory_type_apply | ( | ob_methods * | context, |
object * | lighter, | ||
object * | applier, | ||
int | aflags | ||
) | [static] |
Apply a shop inventory.
context | method context. |
lighter | applied object to apply. |
applier | object attempting to apply the inventory. Should be a player. |
aflags | special flags (always apply/unapply). |
Definition at line 125 of file shop_inventory.c.
References add_shop_item(), draw_ext_info(), draw_ext_info_format(), FLAG_UNPAID, GET_MAP_OB, MAP_HEIGHT, MAP_WIDTH, METHOD_OK, METHOD_UNHANDLED, MSG_TYPE_SHOP, MSG_TYPE_SHOP_LISTING, NDI_UNIQUE, shopinv::nrof, PLAYER, QUERY_FLAG, and shop_sort().
Referenced by init_type_shop_inventory().
static int shop_sort | ( | const void * | a1, |
const void * | a2 | ||
) | [static] |
Sort routine for shopinv.
There are a lot of extra casts in here just to suppress warnings - it makes it look uglier than it really it. The format of the strings we get is type:name. So we first want to sort by type (numerical) - if the same type, then sort by name.
a1 | |
a2 | items to compare. |
Definition at line 65 of file shop_inventory.c.
References shopinv::item_sort, strcasecmp(), and shopinv::type.
Referenced by shop_inventory_type_apply().