inventory.h
Go to the documentation of this file.00001 #ifndef INVENTORY_H_
00002 #define INVENTORY_H_
00003
00004 #include "q_shared.h"
00005
00006 typedef struct inventoryImport_s {
00007 void (*Free) (void* data);
00008
00009 void (*FreeAll) (void);
00010
00011 void *(*Alloc) (size_t size);
00012 } inventoryImport_t;
00013
00014 typedef struct inventoryInterface_s
00015 {
00016
00017 const inventoryImport_t *import;
00018
00019 invList_t* invList;
00020
00021 item_t cacheItem;
00022
00023 csi_t* csi;
00024
00025 const char *name;
00026
00027
00028 qboolean (*RemoveFromInventory) (struct inventoryInterface_s* self, inventory_t* const i, const invDef_t * container, invList_t *fItem) __attribute__((nonnull(1), nonnull(2), warn_unused_result));
00029
00030 invList_t* (*AddToInventory) (struct inventoryInterface_s* self, inventory_t * const i, item_t item, const invDef_t * container, int x, int y,
00031 int amount) __attribute__((nonnull(1), nonnull(2), warn_unused_result));
00032
00033 int (*MoveInInventory) (struct inventoryInterface_s* self, inventory_t* const i, const invDef_t * from, invList_t *item, const invDef_t * to,
00034 int tx, int ty, int *TU, invList_t ** icp) __attribute__((nonnull(1), nonnull(2)));
00035
00036 qboolean (*TryAddToInventory) (struct inventoryInterface_s* self, inventory_t* const inv, item_t item, const invDef_t * container);
00037
00038 void (*DestroyInventory) (struct inventoryInterface_s* self, inventory_t* const i) __attribute__((nonnull(1), nonnull(2)));
00039
00040 void (*EmptyContainer) (struct inventoryInterface_s* self, inventory_t* const i, const invDef_t * container)__attribute__((nonnull(1), nonnull(2)));
00041
00042 void (*EquipActor) (struct inventoryInterface_s* self, inventory_t* const inv, const equipDef_t *ed, const teamDef_t* td) __attribute__((nonnull(1), nonnull(2)));
00043
00044 void (*EquipActorMelee) (struct inventoryInterface_s* self, inventory_t* const inv, const teamDef_t* td) __attribute__((nonnull(1)));
00045
00046 void (*EquipActorRobot) (struct inventoryInterface_s* self, inventory_t* const inv, objDef_t* weapon) __attribute__((nonnull(1), nonnull(2)));
00047
00048 int (*GetUsedSlots) (struct inventoryInterface_s* self);
00049 } inventoryInterface_t;
00050
00051 void INV_InitInventory(const char *name, inventoryInterface_t *ii, csi_t* csi, const inventoryImport_t *iimport);
00052 void INV_DestroyInventory(inventoryInterface_t *ii);
00053
00054 #endif