|
UFO: Alien Invasion
|
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 , FILTER_S_IMPLANT , 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 | |
| bool | INV_MoveItem (Inventory *inv, const invDef_t *toContainer, int px, int py, const invDef_t *fromContainer, Item *fItem, Item **tItem) |
| Move item between containers. | |
| bool | INV_LoadWeapon (const Item *weapon, Inventory *inv, const invDef_t *srcContainer, const invDef_t *destContainer) |
| Load a weapon with ammo. | |
| bool | INV_UnloadWeapon (Item *weapon, Inventory *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 (itemFilterTypes_t 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. | |
| bool | INV_ItemMatchesFilter (const objDef_t *obj, const itemFilterTypes_t filterType) |
| Checks if the given object/item matched the given filter type. | |
| Item * | INV_SearchInInventoryWithFilter (const Inventory *const i, const invDef_t *container, const 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 35 of file cl_inventory.h.
| const equipDef_t * INV_GetEquipmentDefinitionByID | ( | const char * | name | ) |
Gets equipment definition by id.
| [in] | name | An id taken from scripts. |
equipDef_t or nullptr if no equipment definition found. Definition at line 39 of file cl_inventory.cpp.
References Com_Error(), csi, ERR_DROP, i, equipDef_t::id, name, and Q_streq.
Referenced by GAME_AutoTeam(), GAME_ChangeEquip(), GAME_GetCGameAPI(), GAME_GetEquipment(), GAME_GetImportData(), and GAME_Spawn().
| itemFilterTypes_t INV_GetFilterFromItem | ( | const objDef_t * | obj | ) |
Definition at line 240 of file cl_inventory.cpp.
References FILTER_S_ARMOUR, FILTER_S_HEAVY, FILTER_S_IMPLANT, FILTER_S_MISC, FILTER_S_PRIMARY, FILTER_S_SECONDARY, objDef_t::id, objDef_t::implant, objDef_t::isArmour(), objDef_t::isHeavy, objDef_t::isMisc, objDef_t::isPrimary, objDef_t::isSecondary, and Sys_Error().
Referenced by INV_LoadWeapon(), and INV_UpdateObject_f().
| const char * INV_GetFilterType | ( | itemFilterTypes_t | id | ) |
| [in] | id | The filter type index |
Definition at line 419 of file cl_inventory.cpp.
References filterTypeNames, id, and MAX_FILTERTYPES.
Referenced by GAME_GetImportData().
| 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 397 of file cl_inventory.cpp.
References FILTER_S_PRIMARY, filterTypeNames, i, MAX_FILTERTYPES, and Q_streq.
Referenced by GAME_GetImportData(), and cgame_import_t::itemFilterTypes_t().
Definition at line 425 of file cl_inventory.cpp.
References Cmd_AddCommand(), INV_EquipmentDefSanityCheck(), and INV_InitCallbacks().
Referenced by CL_InitLocal().
Prints the description for items (weapons, armour, ...).
| [in] | od | The object definition of the item |
od->isDummy here somewhere? Definition at line 67 of file cl_inventory_callbacks.cpp.
References _, objDef_t::ammo, objDef_t::ammos, CL_WeaponSkillToName(), Com_sprintf(), count, csi, currentDisplayedObject, Cvar_ForceSet(), Cvar_Set(), fireDef_t::damage, itemEffect_t::duration, objDef_t::fd, fireModeIndex, objDef_t::fireTwoHanded, GAME_ItemIsUseable(), i, damageType_t::id, objDef_t::id, objDef_t::implant, objDef_t::isAmmo(), objDef_t::isArmour(), itemEffect_t::isPermanent, itemIndex, fireDef_t::name, objDef_t::name, objDef_t::numAmmos, objDef_t::numFiredefs, objDef_t::numWeapons, itemEffect_t::period, objDef_t::price, Q_strcat(), fireDef_t::range, objDef_t::ratings, fireDef_t::shots, damageType_t::showInMenu, objDef_t::size, fireDef_t::spldmg, fireDef_t::spread, objDef_t::strengthenEffect, TEXT_ITEMDESCRIPTION, fireDef_t::time, UI_ExecuteConfunc(), UI_MAX_SMALLTEXTLEN, UI_RegisterText(), UI_ResetData(), UNIT_SIZE, objDef_t::weapon, objDef_t::weapons, fireDef_t::weaponSkill, objDef_t::weight, and WEIGHT_FACTOR.
Referenced by GAME_GetImportData(), INV_DecreaseFiremode_f(), INV_DecreaseItem_f(), INV_IncreaseFiremode_f(), INV_IncreaseItem_f(), INV_UpdateObject_f(), and cgame_import_t::void().
| bool 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. |
true if obj is in filterType Definition at line 268 of file cl_inventory.cpp.
References Com_Printf(), FILTER_AIRCRAFT, FILTER_CRAFTITEM, FILTER_DISASSEMBLY, FILTER_DUMMY, FILTER_ENSURE_32BIT, FILTER_S_ARMOUR, FILTER_S_HEAVY, FILTER_S_IMPLANT, FILTER_S_MISC, FILTER_S_PRIMARY, FILTER_S_SECONDARY, FILTER_UGVITEM, i, objDef_t::implant, INV_ItemMatchesFilter(), objDef_t::isArmour(), objDef_t::isCraftItem(), objDef_t::isDummy, objDef_t::isHeavy, objDef_t::isMisc, objDef_t::isPrimary, objDef_t::isSecondary, objDef_t::isUGVitem, MAX_FILTERTYPES, MAX_SOLDIER_FILTERTYPES, objDef_t::numWeapons, Q_streq, objDef_t::type, and objDef_t::weapons.
Referenced by cgame_import_t::bool(), GAME_GetImportData(), INV_EquipmentDefSanityCheck(), INV_ItemMatchesFilter(), INV_SearchInInventoryWithFilter(), and UI_ContainerItemIteratorNext().
| bool INV_LoadWeapon | ( | const Item * | weaponList, |
| Inventory * | inv, | ||
| const invDef_t * | srcContainer, | ||
| const invDef_t * | destContainer ) |
Load a weapon with ammo.
| [in] | weaponList | 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 99 of file cl_inventory.cpp.
References objDef_t::ammo, objDef_t::ammos, Item::def(), Item::getFirstShapePosition(), Inventory::getItemAtPos(), Item::getX(), Item::getY(), i, INV_GetFilterFromItem(), INV_MoveItem(), INV_SearchInInventoryWithFilter(), objDef_t::isReloadable(), objDef_t::numAmmos, Item::setAmmoDef(), Item::setAmmoLeft(), and objDef_t::weapons.
Referenced by uiContainerNode::onDndFinished(), and UI_ContainerNodeAutoPlaceItem().
| bool INV_MoveItem | ( | Inventory * | inv, |
| const invDef_t * | toContainer, | ||
| int | toX, | ||
| int | toY, | ||
| const invDef_t * | fromContainer, | ||
| Item * | fItem, | ||
| Item ** | uponItem ) |
Move item between containers.
| [in] | inv | Pointer to the inventory we are working on. |
| [in] | toContainer | Pointer to target container, to place the item in. |
| [in] | toX | target x position in the toContainer container. |
| [in] | toY | target y position in the toContainer container. |
| [in] | fromContainer | Pointer to source container, the item is in. |
| [in] | fItem | Pointer to item being moved. |
| [out] | uponItem | The item the moving item is eventually dropped upon. |
Definition at line 63 of file cl_inventory.cpp.
References _, Inventory::canHoldItemWeight(), cls, GAME_GetChrMaxLoad(), GAME_GetSelectedChr(), IA_ARMOUR, IA_MOVE, IA_RELOAD, IA_RELOAD_SWAP, invDef_t::id, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, and UI_Popup().
Referenced by INV_LoadWeapon(), uiContainerNode::onDndFinished(), UI_ContainerNodeAddItem(), and UI_ContainerNodeAutoPlaceItem().
| Item * INV_SearchInInventoryWithFilter | ( | const Inventory *const | inv, |
| const invDef_t * | container, | ||
| const objDef_t * | itemType, | ||
| 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] | inv | Pointer to the inventory where we will search. |
| [in] | container | Container in the inventory. |
| [in] | itemType | 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). |
Item Pointer to the Item/item that is located at x/y or equals "item". Definition at line 357 of file cl_inventory.cpp.
References Inventory::getContainer2(), Item::getNext(), invDef_t::id, INV_ItemMatchesFilter(), and MAX_FILTERTYPES.
Referenced by INV_LoadWeapon(), uiContainerNode::onDndFinished(), and UI_ContainerNodeGetExistingItem().
Unload a weapon and put the ammo in a container.
| [in,out] | weapon | The weapon to unload ammo. |
| [in,out] | inv | inventory where the change happen. |
| [in] | container | Inventory definition where to put the removed ammo. |
true if the ammo was moved to the container, false otherwise Definition at line 136 of file cl_inventory.cpp.
References Item::ammoDef(), cls, Item::def(), Item::getAmmoLeft(), NONE, Item::setAmmoDef(), and Item::setAmmoLeft().
Referenced by uiContainerNode::onDndFinished(), and UI_ContainerNodeAutoPlaceItem().