Header file for inventory handling and Equipment menu. More...
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_t * | INV_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_t * | INVSH_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, ...). |
Header file for inventory handling and Equipment menu.
Definition in file cl_inventory.h.
enum itemFilterTypes_t |
A list of filter types in the market and production view.
Definition at line 36 of file cl_inventory.h.
const equipDef_t* INV_GetEquipmentDefinitionByID | ( | const char * | name | ) |
Gets equipment definition by id.
Collecting items functions.
[in] | name | An id taken from scripts. |
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 | ) |
Definition at line 222 of file cl_inventory.c.
References FILTER_S_ARMOUR, FILTER_S_HEAVY, FILTER_S_MISC, FILTER_S_PRIMARY, FILTER_S_SECONDARY, objDef_s::id, INV_IsArmour, objDef_s::isHeavy, objDef_s::isMisc, objDef_s::isPrimary, objDef_s::isSecondary, and Sys_Error().
Referenced by INV_LoadWeapon(), and INV_UpdateObject_f().
const char* INV_GetFilterType | ( | const int | id | ) |
[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.
[in] | filterTypeID | Filter type name so search for. |
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 | ) |
Prints the description for items (weapons, armour, ...).
[in] | od | The object definition of the item |
od->isDummy
here somewhere? Definition at line 65 of file cl_inventory_callbacks.c.
References _, objDef_s::ammo, objDef_s::ammos, CL_WeaponSkillToName(), Com_sprintf(), count, csi, Cvar_ForceSet(), Cvar_Set(), fireDef_s::damage, csi_s::dts, objDef_s::fd, fireModeIndex, objDef_s::fireTwoHanded, GAME_ItemIsUseable(), i, damageType_s::id, objDef_s::id, INV_IsAmmo, INV_IsArmour, itemIndex, fireDef_s::name, objDef_s::name, objDef_s::numAmmos, csi_s::numDTs, objDef_s::numFiredefs, objDef_s::numWeapons, Q_strcat(), fireDef_s::range, objDef_s::ratings, objDef_s::reload, fireDef_s::shots, damageType_s::showInMenu, objDef_s::size, fireDef_s::spldmg, fireDef_s::spread, TEXT_ITEMDESCRIPTION, fireDef_s::time, UI_ExecuteConfunc(), UI_MAX_SMALLTEXTLEN, UI_RegisterText(), UI_ResetData(), UNIT_SIZE, va(), objDef_s::weapon, objDef_s::weapons, and fireDef_s::weaponSkill.
Referenced by BS_BuyItem_f(), BS_BuyType(), BS_MarketClick_f(), BS_SellItem_f(), INV_DecreaseFiremode_f(), INV_DecreaseItem_f(), INV_IncreaseFiremode_f(), INV_IncreaseItem_f(), INV_UpdateObject_f(), UP_AircraftDescription(), UP_AircraftItemDescription(), UP_Article(), and UP_UGVDescription().
qboolean INV_ItemMatchesFilter | ( | const objDef_t * | obj, | |
const itemFilterTypes_t | filterType | |||
) |
Checks if the given object/item matched the given filter type.
[in] | obj | A pointer to an objDef_t item. |
[in] | filterType | Filter type to check against. |
Definition at line 248 of file cl_inventory.c.
References Com_Printf(), FILTER_AIRCRAFT, FILTER_CRAFTITEM, FILTER_DISASSEMBLY, FILTER_DUMMY, FILTER_ENSURE_32BIT, FILTER_S_ARMOUR, FILTER_S_HEAVY, FILTER_S_MISC, FILTER_S_PRIMARY, FILTER_S_SECONDARY, FILTER_UGVITEM, INV_IsArmour, INV_IsCraftItem(), INV_ItemMatchesFilter(), objDef_s::isDummy, objDef_s::isHeavy, objDef_s::isMisc, objDef_s::isPrimary, objDef_s::isSecondary, objDef_s::isUGVitem, MAX_FILTERTYPES, MAX_SOLDIER_FILTERTYPES, objDef_s::numWeapons, qfalse, qtrue, objDef_s::type, and objDef_s::weapons.
Referenced by BS_BuyType(), BS_MarketScroll_f(), INV_EquipmentDefSanityCheck(), INV_ItemMatchesFilter(), INVSH_SearchInInventoryWithFilter(), PR_ProductionListClick_f(), PR_ProductionListRightClick_f(), PR_UpdateProductionList(), and UI_ContainerItemIteratorNext().
void INV_LoadWeapon | ( | invList_t * | weapon, | |
inventory_t * | inv, | |||
const invDef_t * | srcContainer, | |||
const invDef_t * | destContainer | |||
) |
Load a weapon with ammo.
[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.
[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. |
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.
[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. |
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).
[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). |
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().