cl_inventory.h File Reference

Header file for inventory handling and Equipment menu. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  itemFilterTypes_t {
  FILTER_S_PRIMARY, FILTER_S_SECONDARY, FILTER_S_HEAVY, FILTER_S_MISC,
  FILTER_S_ARMOUR, MAX_SOLDIER_FILTERTYPES, FILTER_CRAFTITEM, FILTER_UGVITEM,
  FILTER_AIRCRAFT, FILTER_DUMMY, FILTER_DISASSEMBLY, MAX_FILTERTYPES,
  FILTER_ENSURE_32BIT = 0x7FFFFFFF
}
 

A list of filter types in the market and production view.

More...

Functions

qboolean INV_MoveItem (inventory_t *inv, const invDef_t *toContainer, int px, int py, const invDef_t *fromContainer, invList_t *fItem)
 Move item between containers.
void INV_LoadWeapon (invList_t *weapon, inventory_t *inv, const invDef_t *srcContainer, const invDef_t *destContainer)
 Load a weapon with ammo.
qboolean INV_UnloadWeapon (invList_t *weapon, inventory_t *inv, const invDef_t *container)
 Unload a weapon and put the ammo in a container.
const equipDef_tINV_GetEquipmentDefinitionByID (const char *name)
 Gets equipment definition by id.
void INV_InitStartup (void)
itemFilterTypes_t INV_GetFilterFromItem (const objDef_t *obj)
const char * INV_GetFilterType (const int id)
itemFilterTypes_t INV_GetFilterTypeID (const char *filterTypeID)
 Searches for a filter type name (as used in console functions) and returns the matching itemFilterTypes_t enum.
qboolean INV_ItemMatchesFilter (const objDef_t *obj, const itemFilterTypes_t filterType)
 Checks if the given object/item matched the given filter type.
invList_tINVSH_SearchInInventoryWithFilter (const inventory_t *const i, const invDef_t *container, int x, int y, objDef_t *item, const itemFilterTypes_t filterType) __attribute__((nonnull(1)))
 Searches if there is an item at location (x/y) in a scrollable container. You can also provide an item to search for directly (x/y is ignored in that case).
void INV_ItemDescription (const objDef_t *od)
 Prints the description for items (weapons, armour, ...).

Detailed Description

Header file for inventory handling and Equipment menu.

Definition in file cl_inventory.h.


Enumeration Type Documentation

A list of filter types in the market and production view.

Note:
Run-time only, please do not use this in savegame/structures and the like. Please also do not use hardcoded numbers to access this (e.g. in a .ufo script).
See also:
inv_shared.c:INV_ItemMatchesFilter
inv_shared.c:INV_GetFilterTypeID
Enumerator:
FILTER_S_PRIMARY 

All 'Primary' weapons and their ammo for soldiers (Except for heavy weapons).

FILTER_S_SECONDARY 

All 'Secondary' weapons and their ammo for soldiers.

FILTER_S_HEAVY 

Heavy weapons for soldiers.

FILTER_S_MISC 

Misc. soldier equipment (i.e. everything else that is not in the other soldier-item filters)

FILTER_S_ARMOUR 

Armour for soldiers.

MAX_SOLDIER_FILTERTYPES 
FILTER_CRAFTITEM 

Aircraft equipment.

FILTER_UGVITEM 

Heavy equipment like tanks (i.e. these are actually employees) and their parts. Some of the content are special normal items (like for soldiers). The UGVs themself are specially handled.

FILTER_AIRCRAFT 

Aircrafts.

FILTER_DUMMY 

Everything that is not in _any_ of the other filter types. Mostly plot-relevant stuff, unproducible stuff and stuff.

FILTER_DISASSEMBLY 
MAX_FILTERTYPES 
FILTER_ENSURE_32BIT 

Definition at line 36 of file cl_inventory.h.


Function Documentation

const equipDef_t* INV_GetEquipmentDefinitionByID ( const char *  name  ) 

Gets equipment definition by id.

Collecting items functions.

Parameters:
[in] name An id taken from scripts.
Returns:
Found equipDef_t or NULL if no equipment definition found.

Definition at line 41 of file cl_inventory.c.

References Com_Error(), csi, csi_s::eds, ERR_DROP, i, equipDef_s::name, and csi_s::numEDs.

Referenced by B_InitialEquipment(), B_SetUpFirstBase(), BS_InitMarket(), GAME_MP_AutoTeam(), GAME_SK_ChangeEquip_f(), GAME_SK_Start_f(), GAME_Spawn(), and MP_GetEquipment().

itemFilterTypes_t INV_GetFilterFromItem ( const objDef_t obj  ) 
const char* INV_GetFilterType ( const int  id  ) 
Parameters:
[in] id The filter type index

Definition at line 398 of file cl_inventory.c.

References MAX_FILTERTYPES.

Referenced by BS_BuyAircraft_f(), BS_BuyType_f(), and PR_ProductionType_f().

itemFilterTypes_t INV_GetFilterTypeID ( const char *  filterTypeID  ) 

Searches for a filter type name (as used in console functions) and returns the matching itemFilterTypes_t enum.

Parameters:
[in] filterTypeID Filter type name so search for.
See also:
filterTypeNames.

Definition at line 375 of file cl_inventory.c.

References FILTER_S_PRIMARY, and MAX_FILTERTYPES.

Referenced by BS_BuyType_f(), and PR_ProductionType_f().

void INV_InitStartup ( void   ) 

Definition at line 405 of file cl_inventory.c.

References Cmd_AddCommand(), INV_EquipmentDefSanityCheck(), and INV_InitCallbacks().

Referenced by CL_InitLocal().

void INV_ItemDescription ( const objDef_t od  ) 
qboolean INV_ItemMatchesFilter ( const objDef_t obj,
const itemFilterTypes_t  filterType 
)
void INV_LoadWeapon ( invList_t weapon,
inventory_t inv,
const invDef_t srcContainer,
const invDef_t destContainer 
)

Load a weapon with ammo.

Parameters:
[in] weapon Pointer to weapon to load.
[in] inv Pointer to inventory where the change happen.
[in] srcContainer Pointer to inventorydef where to search ammo.
[in] destContainer Pointer to inventorydef where the weapon is.

Definition at line 94 of file cl_inventory.c.

References objDef_s::ammos, i, INV_GetFilterFromItem(), INV_MoveItem(), INVSH_SearchInInventoryWithFilter(), invList_s::item, NONE, item_s::t, invList_s::x, and invList_s::y.

Referenced by UI_ContainerNodeAutoPlace(), and UI_ContainerNodeDNDFinished().

qboolean INV_MoveItem ( inventory_t inv,
const invDef_t toContainer,
int  px,
int  py,
const invDef_t fromContainer,
invList_t fItem 
)

Move item between containers.

Parameters:
[in] inv Pointer to the list where the item is currently in.
[in] toContainer Pointer to target container, to place the item in.
[in] px target x position in the toContainer container.
[in] py target y position in the toContainer container.
[in] fromContainer Pointer to source container, the item is in.
[in] fItem Pointer to item being moved.
Note:
If you set px or py to -1/NONE the item is automatically placed on
a free spot in the targetContainer
Returns:
qtrue if the move was successful.

Definition at line 64 of file cl_inventory.c.

References cls, client_static_s::i, IA_ARMOUR, IA_MOVE, inventoryInterface_s::MoveInInventory, qfalse, qtrue, SHAPE_BIG_MAX_HEIGHT, and SHAPE_BIG_MAX_WIDTH.

Referenced by INV_LoadWeapon(), UI_ContainerNodeAutoPlace(), and UI_ContainerNodeDNDFinished().

qboolean INV_UnloadWeapon ( invList_t weapon,
inventory_t inv,
const invDef_t container 
)

Unload a weapon and put the ammo in a container.

Parameters:
[in] weapon Pointer (invList_t) to weapon to unload ammo.
[in] inv Pointer (inventory_t) to inventory where the change happen.
[in] container Pointer (invDef_t) to inventorydef where to put the removed ammo.
Returns:
true if the unload was successful, false otherwise

Definition at line 119 of file cl_inventory.c.

References item_s::a, inventoryInterface_s::AddToInventory, cls, client_static_s::i, invList_s::item, item_s::m, NONE, NONE_AMMO, qfalse, and qtrue.

Referenced by UI_ContainerNodeAutoPlace(), and UI_ContainerNodeDNDFinished().

invList_t* INVSH_SearchInInventoryWithFilter ( const inventory_t *const   i,
const invDef_t container,
int  x,
int  y,
objDef_t item,
const itemFilterTypes_t  filterType 
)

Searches if there is an item at location (x/y) in a scrollable container. You can also provide an item to search for directly (x/y is ignored in that case).

Note:
x = x-th item in a row, y = row. i.e. x/y does not equal the "grid" coordinates as used in those containers.
Parameters:
[in] i Pointer to the inventory where we will search.
[in] container Container in the inventory.
[in] x/y Position in the scrollable container that you want to check. Ignored if "item" is set.
[in] item The item to search. Will ignore "x" and "y" if set, it'll also search invisible items.
[in] filterType Enum definition of type (types of items for filtering purposes).
Returns:
invList_t Pointer to the invList_t/item that is located at x/y or equals "item".
See also:
INVSH_SearchInInventory

Definition at line 334 of file cl_inventory.c.

References inventory_s::c, invDef_s::id, INV_ItemMatchesFilter(), invList_s::item, MAX_FILTERTYPES, invList_s::next, and item_s::t.

Referenced by INV_LoadWeapon(), and UI_ContainerNodeGetExistingItem().


Generated by  doxygen 1.6.2