|
UFO: Alien Invasion
|
inventory definition with all its containers More...
#include <inv_shared.h>

Public Member Functions | |
| Inventory () | |
| virtual | ~Inventory () |
| void | init () |
| const Container & | getContainer (const containerIndex_t idx) const |
| Item * | getContainer2 (const containerIndex_t idx) const |
| void | setContainer (const containerIndex_t idx, Item *cont) |
| void | resetContainer (const containerIndex_t idx) |
| void | resetTempContainers () |
| bool | containsItem (const containerIndex_t contId, const Item *const item) const |
| Searches if there is a specific item already in the inventory&container. | |
| Item * | getArmour () const |
| Item * | getHeadgear () const |
| Item * | getRightHandContainer () const |
| Item * | getLeftHandContainer () const |
| Item * | getHolsterContainer () const |
| Item * | getEquipContainer () const |
| Item * | getImplantContainer () const |
| Item * | getFloorContainer () const |
| void | setFloorContainer (Item *cont) |
| void | findSpace (const invDef_t *container, const Item *item, int *const px, int *const py, const Item *ignoredItem) const |
| Finds space for item in inv at container. | |
| Item * | findInContainer (const containerIndex_t contId, const Item *const item) const |
| Searches a specific item in the inventory&container. | |
| Item * | getItemAtPos (const invDef_t *container, const int x, const int y) const |
| Searches if there is an item at location (x,y) in a container. | |
| int | getWeight () const |
| Get the weight of the items in the given inventory (excluding those in temp containers). | |
| int | canHoldItem (const invDef_t *container, const objDef_t *od, const int x, const int y, const Item *ignoredItem) const |
| bool | canHoldItemWeight (containerIndex_t from, containerIndex_t to, const Item &item, int maxWeight) const |
| Check that adding an item to the inventory won't exceed the max permitted weight. | |
| bool | holdsReactionFireWeapon () const |
| Checks if there is a weapon in the hands that can be used for reaction fire. | |
| const Container * | getNextCont (const Container *prev, bool inclTemp=false) const |
| int | countItems () const |
| Count the number of items in the inventory (without temp containers). | |
Protected Member Functions | |
| const Container * | _getNextCont (const Container *prev) const |
Protected Attributes | |
| Container | _containers [MAX_CONTAINERS] |
inventory definition with all its containers
Definition at line 525 of file inv_shared.h.
| Inventory::Inventory | ( | ) |
Definition at line 692 of file inv_shared.cpp.
References init().
|
inlinevirtual |
Definition at line 534 of file inv_shared.h.
Definition at line 710 of file inv_shared.cpp.
References _containers, and CID_MAX.
Referenced by getNextCont().
| int Inventory::canHoldItem | ( | const invDef_t * | container, |
| const objDef_t * | od, | ||
| const int | x, | ||
| const int | y, | ||
| const Item * | ignoredItem ) const |
| [in] | container | The index of the container in the inventory to check the item in. |
| [in] | od | The type of item to check in the inventory. |
| [in] | x | The x value in the container (1 << x in the shape bitmask) |
| [in] | y | The y value in the container (SHAPE_BIG_MAX_HEIGHT is the max) |
| [in] | ignoredItem | You can ignore one item in the container (most often the currently dragged one). Use nullptr if you want to check against all items in the container. |
< Return INV_FITS_BOTH if both if statements where true above.
< We are returning with status true (1) if the item does not fit at all - unlikely but not impossible.
< Return INV_FITS_BOTH if both if statements where true above.
Definition at line 761 of file inv_shared.cpp.
References invDef_t::all, invDef_t::armour, CID_LEFT, CID_RIGHT, Com_DPrintf(), containsItem(), DEBUG_SHARED, objDef_t::fireTwoHanded, getContainer2(), objDef_t::getShapeRotated(), invDef_t::headgear, objDef_t::headgear, objDef_t::holdTwoHanded, invDef_t::id, invDef_t::implant, objDef_t::implant, INV_DOES_NOT_FIT, INV_FITS, INV_FITS_ONLY_ROTATED, INVSH_CheckToInventory_shape(), objDef_t::isArmour(), invDef_t::isEquipDef(), invDef_t::isFloorDef(), invDef_t::isLeftDef(), invDef_t::isRightDef(), invDef_t::scroll, objDef_t::shape, invDef_t::single, and invDef_t::unique.
Referenced by InventoryInterface::addToInventory(), findSpace(), InventoryInterface::moveInInventory(), InventoryInterface::tryAddToInventory(), and UI_ContainerNodeDrawFreeSpace().
| bool Inventory::canHoldItemWeight | ( | containerIndex_t | from, |
| containerIndex_t | to, | ||
| const Item & | item, | ||
| int | maxWeight ) const |
Check that adding an item to the inventory won't exceed the max permitted weight.
| [in] | from | Index of the container the item comes from. |
| [in] | to | Index of the container the item is being placed. |
| [in] | item | The item that is being added. |
| [in] | maxWeight | The max permitted weight. |
true if it is Ok to add the item false otherwise. Definition at line 919 of file inv_shared.cpp.
References CSI, getArmour(), getWeight(), Item::getWeight(), and Item::isArmour().
Referenced by CL_ActorInvMove(), G_ActorInvMove(), G_ClientReadInventory(), GAME_LoadInventory(), and INV_MoveItem().
|
inline |
Searches if there is a specific item already in the inventory&container.
| [in] | contId | Container in the inventory. |
| [in] | item | The item to search for. |
Definition at line 572 of file inv_shared.h.
References findInContainer().
Referenced by canHoldItem(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().
| int Inventory::countItems | ( | ) | const |
Count the number of items in the inventory (without temp containers).
Definition at line 741 of file inv_shared.cpp.
References Container::countItems(), and getNextCont().
Referenced by GAME_NetSendInventory().
| Item * Inventory::findInContainer | ( | const containerIndex_t | contId, |
| const Item *const | searchItem ) const |
Searches a specific item in the inventory&container.
| [in] | contId | Container in the inventory. |
| [in] | searchItem | The item to search for. |
nullptr. Definition at line 1001 of file inv_shared.cpp.
References getContainer(), Container::getNextItem(), and Item::isSameAs().
Referenced by containsItem().
| void Inventory::findSpace | ( | const invDef_t * | container, |
| const Item * | item, | ||
| int *const | px, | ||
| int *const | py, | ||
| const Item * | ignoredItem ) const |
Finds space for item in inv at container.
| [in] | item | The item to check the space for |
| [in] | container | The container to search in |
| [out] | px | The x position in the container |
| [out] | py | The y position in the container |
| [in] | ignoredItem | You can ignore one item in the container (most often the currently dragged one). Use nullptr if you want to check against all items in the container. |
Definition at line 876 of file inv_shared.cpp.
References cacheCheckToInventory, canHoldItem(), Com_DPrintf(), DEBUG_SHARED, Item::def(), objDef_t::id, INV_DOES_NOT_FIT, INV_FITS, invDef_t::name, NONE, invDef_t::scroll, SHAPE_BIG_MAX_HEIGHT, SHAPE_BIG_MAX_WIDTH, and objDef_t::type.
Referenced by InventoryInterface::addToInventory(), G_ActorInvMove(), InventoryInterface::moveInInventory(), TEST_F(), TEST_F(), and InventoryInterface::tryAddToInventory().
| Item * Inventory::getArmour | ( | ) | const |
Definition at line 990 of file inv_shared.cpp.
References CID_ARMOUR, and getContainer2().
Referenced by canHoldItemWeight(), CHRSH_CharGetBody(), CHRSH_CharGetHead(), and GAME_CollectItems().
|
inline |
Definition at line 537 of file inv_shared.h.
References _containers.
Referenced by CP_CleanupContainerWeapons(), findInContainer(), getContainer2(), getItemAtPos(), INVSH_CheckToInventory_shape(), and InventoryInterface::moveInInventory().
|
inline |
Definition at line 546 of file inv_shared.h.
References Container::_invList, and getContainer().
Referenced by InventoryInterface::addInvList(), InventoryInterface::addToInventory(), canHoldItem(), CL_ActorGetContainerForReload(), CL_ActorReload(), CP_CleanupContainerWeapons(), CP_SetEquipContainer(), InventoryInterface::emptyContainer(), GAME_NetSendInventory(), getArmour(), getEquipContainer(), getFloorContainer(), getHeadgear(), getHolsterContainer(), getImplantContainer(), getItemAtPos(), getLeftHandContainer(), getRightHandContainer(), HUD_WeaponCanBeReloaded(), INV_SearchInInventoryWithFilter(), InventoryInterface::PackAmmoAndWeapon(), and InventoryInterface::removeFromInventory().
| Item * Inventory::getEquipContainer | ( | ) | const |
Definition at line 980 of file inv_shared.cpp.
References CID_EQUIP, and getContainer2().
Referenced by UI_ContainerNodeUpdateEquipment().
| Item * Inventory::getFloorContainer | ( | ) | const |
Definition at line 975 of file inv_shared.cpp.
References CID_FLOOR, and getContainer2().
| Item * Inventory::getHeadgear | ( | ) | const |
Definition at line 965 of file inv_shared.cpp.
References CID_HEADGEAR, and getContainer2().
Referenced by G_PrepareShot(), HUD_UpdateActorFireMode(), and HUD_UpdateButtons().
| Item * Inventory::getHolsterContainer | ( | ) | const |
Definition at line 970 of file inv_shared.cpp.
References CID_HOLSTER, and getContainer2().
Referenced by CL_GetSkillIndicator().
| Item * Inventory::getImplantContainer | ( | ) | const |
Definition at line 985 of file inv_shared.cpp.
References CID_IMPLANT, and getContainer2().
Searches if there is an item at location (x,y) in a container.
| [in] | container | Container in the inventory. |
| [in] | x/y | Position in the container that you want to check. |
Definition at line 844 of file inv_shared.cpp.
References getContainer(), getContainer2(), Container::getNextItem(), invDef_t::id, INVSH_ShapeCheckPosition(), invDef_t::name, invDef_t::scroll, invDef_t::single, and Sys_Error().
Referenced by CL_ActorInvMove(), CL_InvAmmo(), CL_InvDel(), CL_InvReload(), G_ActorInvMove(), G_ClientAction(), INV_LoadWeapon(), and InventoryInterface::moveInInventory().
| Item * Inventory::getLeftHandContainer | ( | ) | const |
Definition at line 960 of file inv_shared.cpp.
References CID_LEFT, and getContainer2().
Referenced by CL_ActorCvars(), and holdsReactionFireWeapon().
Definition at line 722 of file inv_shared.cpp.
References _containers, _getNextCont(), CID_EQUIP, and CID_FLOOR.
Referenced by AI_SearchGrenade(), AII_CarriedItems(), AIR_TransferItemsCarriedByCharacterToBase(), AM_MoveCharacterInventoryIntoItemCargo(), countItems(), InventoryInterface::destroyInventory(), E_RemoveInventoryFromStorage(), G_ActorReload(), G_ClientCanReload(), G_ClientGetWeaponFromInventory(), G_InventoryToFloor(), G_MissionTouch(), G_SendInventory(), GAME_SaveInventory(), InventoryInterface::GetInventoryState(), getWeight(), HUD_UpdateActorLoad_f(), INV_UpdateActorLoad_f(), resetTempContainers(), and TEST_F().
| Item * Inventory::getRightHandContainer | ( | ) | const |
Definition at line 955 of file inv_shared.cpp.
References CID_RIGHT, and getContainer2().
Referenced by CL_ActorCvars(), CL_GetSkillIndicator(), CP_CleanupAircraftTeam(), CP_CleanupTeam(), and holdsReactionFireWeapon().
| int Inventory::getWeight | ( | ) | const |
Get the weight of the items in the given inventory (excluding those in temp containers).
Definition at line 937 of file inv_shared.cpp.
References getNextCont(), Container::getNextItem(), and Item::getWeight().
Referenced by canHoldItemWeight(), G_ActorCalculateMaxTU(), G_ClientAssignDefaultActorValues(), G_UpdateCarriedWeight(), InventoryInterface::GetInventoryState(), and INV_UpdateActorLoad_f().
| bool Inventory::holdsReactionFireWeapon | ( | ) | const |
Checks if there is a weapon in the hands that can be used for reaction fire.
Definition at line 1016 of file inv_shared.cpp.
References getLeftHandContainer(), and getRightHandContainer().
Referenced by G_ReactionFireCanBeEnabled(), HUD_ToggleReaction_f(), and HUD_UpdateButtons().
| void Inventory::init | ( | ) |
Definition at line 703 of file inv_shared.cpp.
References _containers, CID_MAX, i, and OBJZERO.
Referenced by B_LoadXML(), InventoryInterface::destroyInventory(), and Inventory().
|
inline |
Definition at line 554 of file inv_shared.h.
References _containers.
Referenced by CP_SetEquipContainer(), InventoryInterface::emptyContainer(), and resetTempContainers().
|
inline |
Definition at line 557 of file inv_shared.h.
References Container::def(), getNextCont(), Container::id, resetContainer(), and invDef_t::temp.
Referenced by GAME_SendCurrentTeamSpawningInfo().
|
inline |
Definition at line 550 of file inv_shared.h.
References _containers.
Referenced by InventoryInterface::addInvList(), CP_SetEquipContainer(), GAME_ActorSelect_f(), InventoryInterface::removeFromInventory(), and setFloorContainer().
Definition at line 950 of file inv_shared.cpp.
References CID_FLOOR, and setContainer().
|
protected |
Definition at line 527 of file inv_shared.h.
Referenced by _getNextCont(), getContainer(), getNextCont(), init(), resetContainer(), and setContainer().