|
UFO: Alien Invasion
|
item instance data, with linked list capability More...
#include <inv_shared.h>

Public Member Functions | |
| Item () | |
| Item constructor with all default values. | |
| Item (const objDef_t *_itemDef, const objDef_t *ammo=nullptr, int ammoLeft=0) | |
| Item constructor with the 3 most often changed attributes. | |
| void | setNext (Item *nx) |
| void | setX (const int val) |
| void | setY (const int val) |
| void | setAmmoDef (const objDef_t *od) |
| void | setAmount (int value) |
| void | setAmmoLeft (int value) |
| void | setDef (const objDef_t *objDef) |
| Item * | getNext () const |
| int | getX () const |
| int | getY () const |
| const objDef_t * | ammoDef (void) const |
| int | getAmount () const |
| int | getAmmoLeft () const |
| const objDef_t * | def (void) const |
| bool | isHeldTwoHanded () const |
| bool | isReloadable () const |
| bool | mustReload () const |
| bool | isWeapon () const |
| bool | isArmour () const |
| bool | isSameAs (const Item *const other) const |
| Check if the (physical) information of 2 items is exactly the same. | |
| void | addAmount (int value) |
| int | getWeight () const |
| Return the weight of an item. | |
| void | getFirstShapePosition (int *const x, int *const y) const |
| Calculates the first "true" bit in the shape and returns its position in the item. | |
| const objDef_t * | getReactionFireWeaponType () const |
| Checks whether this item is a reaction fire enabled weapon. | |
| const fireDef_t * | getFiredefs () const |
| Returns the firedefinitions for a given weapon/ammo. | |
| int | getNumFiredefs () const |
| const fireDef_t * | getSlowestFireDef () const |
| Get the firedef that uses the most TU for this item. | |
| const fireDef_t * | getFastestFireDef () const |
Data Fields | |
| int | rotated |
Private Attributes | |
| const objDef_t * | _itemDef |
| const objDef_t * | _ammoDef |
| Item * | _next |
| int | _x |
| int | _y |
| int | _amount |
| int | _ammoLeft |
item instance data, with linked list capability
Definition at line 402 of file inv_shared.h.
| Item::Item | ( | ) |
Item constructor with all default values.
Definition at line 497 of file inv_shared.cpp.
References _itemDef, _next, _x, _y, NONE_AMMO, rotated, setAmmoDef(), setAmmoLeft(), and setAmount().
Referenced by getNext(), isSameAs(), and setNext().
Item constructor with the 3 most often changed attributes.
Definition at line 508 of file inv_shared.cpp.
References _itemDef, _next, _x, _y, rotated, setAmmoDef(), setAmmoLeft(), and setAmount().
Definition at line 497 of file inv_shared.h.
References _amount.
Referenced by InventoryInterface::addToInventory(), and InventoryInterface::removeFromInventory().
Definition at line 460 of file inv_shared.h.
References _ammoDef.
Referenced by actorL_throwgrenade(), equipDef_t::addClip(), AI_FindBestFiredef(), AI_GetItemFromInventory(), AI_HasLineOfFire(), AII_CollectAmmo(), AIL_GetBestShot(), AIR_GetStorageRoom(), AIR_MoveEmployeeInventoryIntoStorage(), AIR_TransferItemsCarriedByCharacterToBase(), AM_MoveCharacterInventoryIntoItemCargo(), CL_GetSkillIndicator(), CP_AddWeaponAmmo(), E_RemoveInventoryFromStorage(), G_ActorInvMove(), G_ClientShoot(), G_EventInventoryReload(), G_WriteItem(), GAME_LoadItem(), GAME_NetSendItem(), GAME_SaveItem(), ReactionFire::getFireDef(), getFiredefs(), getNumFiredefs(), getWeight(), HUD_ReactionFireGetTUs(), HUD_UpdateActor(), HUD_UpdateActorFireMode(), HUD_WeaponCanBeReloaded(), INV_UnloadWeapon(), isSameAs(), InventoryInterface::moveInInventory(), uiContainerNode::onDndFinished(), InventoryInterface::PackAmmoAndWeapon(), TR_Add_f(), UI_ContainerNodeAutoPlaceItem(), and UI_GetItemTooltip().
Definition at line 469 of file inv_shared.h.
References _itemDef.
Referenced by equipDef_t::addClip(), InventoryInterface::addToInventory(), AI_FindBestFiredef(), AI_SearchGrenade(), AII_CarriedItems(), AIL_roundsleft(), AIL_weapontype(), AIR_GetStorageRoom(), AIR_MoveEmployeeInventoryIntoStorage(), AIR_TransferItemsCarriedByCharacterToBase(), AM_MoveCharacterInventoryIntoItemCargo(), CHRSH_CharGetBody(), CHRSH_CharGetHead(), CL_ActorCvars(), CL_ActorGetMuzzle(), CL_ActorReload(), CL_GetSkillIndicator(), CL_InvAdd(), CL_InvReload(), CL_NetReceiveItem(), CP_AddWeaponAmmo(), CP_CleanupAircraftTeam(), CP_CleanupContainerWeapons(), CP_CleanupTeam(), uiBaseInventoryNode::draw(), uiContainerNode::draw(), uiItemNode::draw(), E_RemoveInventoryFromStorage(), InventoryInterface::EquipActorMelee(), Inventory::findSpace(), G_ActorGetTUForReactionFire(), G_ActorInvMove(), G_ActorReload(), G_ApplyProtection(), G_ClientCanReload(), G_ClientGetWeaponFromInventory(), G_ClientReadInventory(), G_ClientShoot(), G_EventActorAppear(), G_EventInventoryReload(), G_InventoryDropToFloorCheck(), G_InventoryRemoveItemByID(), G_InventoryToFloor(), G_MissionThink(), G_MissionTouch(), G_SendInventory(), G_ShootGrenade(), G_ShootSingle(), G_ShotMorale(), G_WriteItem(), GAME_CollectItems(), GAME_LoadInventory(), GAME_LoadItem(), GAME_NetSendItem(), GAME_SaveItem(), getFiredefs(), getNumFiredefs(), getReactionFireWeaponType(), getWeight(), HUD_CheckReload(), HUD_CheckShooting(), HUD_DisplayActions(), HUD_GetFireDefinitionForHand(), HUD_GetMinimumTUsForUsage(), HUD_UpdateActor(), HUD_UpdateActorCvar(), HUD_UpdateActorFireMode(), HUD_UpdateActorLoad_f(), HUD_UpdateActorStats(), HUD_WeaponCanBeReloaded(), INV_LoadWeapon(), INV_UnloadWeapon(), INVSH_CheckToInventory_shape(), INVSH_ShapeCheckPosition(), isSameAs(), LE_BiggestItem(), InventoryInterface::moveInInventory(), uiContainerNode::onDndFinished(), uiContainerNode::onDndMove(), InventoryInterface::PackAmmoAndWeapon(), InventoryInterface::removeFromInventory(), TEST_F(), TEST_F(), TR_Add_f(), InventoryInterface::tryAddToInventory(), UI_BaseInventoryNodeDrawItems(), UI_ContainerNodeAutoPlaceItem(), UI_ContainerNodeDrawDropPreview(), UI_ContainerNodeDrawFreeSpace(), UI_ContainerNodeDrawGrid(), UI_ContainerNodeDrawSingle(), UI_ContainerNodeUpdateEquipment(), UI_DrawItem(), and UI_GetItemTooltip().
|
inline |
Definition at line 466 of file inv_shared.h.
References _ammoLeft.
Referenced by equipDef_t::addClip(), AII_CarriedItems(), AII_CollectAmmo(), AIL_roundsleft(), AIR_MoveEmployeeInventoryIntoStorage(), AM_MoveCharacterInventoryIntoItemCargo(), CL_InvReload(), CP_AddWeaponAmmo(), G_ClientShoot(), G_WriteItem(), GAME_LoadItem(), GAME_NetSendItem(), GAME_SaveItem(), getWeight(), HUD_UpdateActorCvar(), HUD_WeaponCanBeReloaded(), INV_UnloadWeapon(), isSameAs(), InventoryInterface::moveInInventory(), mustReload(), uiContainerNode::onDndFinished(), TR_Add_f(), UI_ContainerNodeAutoPlaceItem(), and UI_GetItemTooltip().
|
inline |
Definition at line 463 of file inv_shared.h.
References _amount.
Referenced by InventoryInterface::addToInventory(), CL_InvAdd(), G_ActorInvMove(), G_InventoryToFloor(), G_WriteItem(), GAME_NetSendItem(), GAME_SaveItem(), GAMETEST_GetItemCount(), InventoryInterface::moveInInventory(), InventoryInterface::removeFromInventory(), UI_BaseInventoryNodeDrawItems(), and UI_GetItemTooltip().
| const fireDef_t * Item::getFastestFireDef | ( | ) | const |
Definition at line 624 of file inv_shared.cpp.
References getFiredefs(), getNumFiredefs(), i, nullptr, and fireDef_t::time.
Referenced by AIL_positionshoot(), AIL_tusforshooting(), and HUD_GetMinimumTUsForUsage().
| const fireDef_t * Item::getFiredefs | ( | ) | const |
Returns the firedefinitions for a given weapon/ammo.
nullptr if the ammo doesn't support the given weapon Definition at line 576 of file inv_shared.cpp.
References ammoDef(), def(), objDef_t::fd, i, objDef_t::numWeapons, and objDef_t::weapons.
Referenced by actorL_throwgrenade(), AI_FighterCalcActionScore(), AI_HasLineOfFire(), AI_HideNeeded(), AIL_GetBestShot(), CL_ActorGetReactionFireFireDef(), CL_GetSkillIndicator(), G_ActorGetTUForReactionFire(), G_ActorHasWorkingFireModeSet(), G_PrepareShot(), getFastestFireDef(), ReactionFire::getFireDef(), getNumFiredefs(), getReactionFireWeaponType(), getSlowestFireDef(), HUD_GetFireDefinitionForHand(), HUD_ReactionFireGetTUs(), HUD_UpdateActorFireMode(), HUD_UpdateActorLoad_f(), and ReactionFire::shoot().
Calculates the first "true" bit in the shape and returns its position in the item.
| [out] | x | The x location inside the item. |
| [out] | y | The x location inside the item. |
Definition at line 557 of file inv_shared.cpp.
References getX(), getY(), INVSH_ShapeCheckPosition(), NONE, and SHAPE_SMALL_MAX_HEIGHT.
Referenced by CL_ActorReload(), G_ActorInvMove(), and INV_LoadWeapon().
|
inline |
Definition at line 451 of file inv_shared.h.
Referenced by InventoryInterface::addInvList(), InventoryInterface::addToInventory(), AII_CarriedItems(), AIL_findweapons(), AIR_MoveEmployeeInventoryIntoStorage(), CL_ActorGetContainerForReload(), CP_CleanupContainerWeapons(), InventoryInterface::emptyContainer(), G_InventoryDropToFloorCheck(), G_InventoryRemoveItemByID(), G_InventoryToFloor(), G_MissionThink(), GAME_NetSendInventory(), GAMETEST_GetItemCount(), Container::getNextItem(), InventoryInterface::GetUsedSlots(), INV_SearchInInventoryWithFilter(), LE_BiggestItem(), InventoryInterface::removeFromInventory(), InventoryInterface::removeInvList(), and TR_Add_f().
| int Item::getNumFiredefs | ( | ) | const |
Definition at line 597 of file inv_shared.cpp.
References ammoDef(), def(), getFiredefs(), objDef_t::numFiredefs, objDef_t::numWeapons, and fireDef_t::weapFdsIdx.
Referenced by getFastestFireDef().
| const objDef_t * Item::getReactionFireWeaponType | ( | ) | const |
Checks whether this item is a reaction fire enabled weapon.
nullptr if no reaction fire enabled weapon, the reaction fire enabled object otherwise. Definition at line 649 of file inv_shared.cpp.
References def(), getFiredefs(), and fireDef_t::reaction.
Referenced by G_ReactionFireSettingsSetDefault().
| const fireDef_t * Item::getSlowestFireDef | ( | ) | const |
Get the firedef that uses the most TU for this item.
nullptr. Definition at line 610 of file inv_shared.cpp.
References getFiredefs(), i, and MAX_FIREDEFS_PER_WEAPON.
Referenced by InventoryInterface::EquipActorNormal().
| int Item::getWeight | ( | ) | const |
Return the weight of an item.
Definition at line 522 of file inv_shared.cpp.
References ammoDef(), def(), getAmmoLeft(), and objDef_t::weight.
Referenced by Inventory::canHoldItemWeight(), InventoryInterface::EquipActorNormal(), Inventory::getWeight(), and InventoryInterface::PackAmmoAndWeapon().
|
inline |
Definition at line 454 of file inv_shared.h.
References _x.
Referenced by CL_ActorReload(), uiBaseInventoryNode::drawTooltip(), uiContainerNode::drawTooltip(), G_ActorInvMove(), G_EventInventoryReload(), G_InventoryRemoveItemByID(), G_InventoryToFloor(), G_SendInventory(), GAME_NetSendInventory(), GAME_SaveInventory(), getFirstShapePosition(), INV_LoadWeapon(), INVSH_CheckToInventory_shape(), INVSH_ShapeCheckPosition(), InventoryInterface::moveInInventory(), UI_BaseInventoryNodeGetItem(), and UI_ContainerNodeDrawGrid().
|
inline |
Definition at line 457 of file inv_shared.h.
References _y.
Referenced by CL_ActorReload(), uiBaseInventoryNode::drawTooltip(), uiContainerNode::drawTooltip(), G_ActorInvMove(), G_EventInventoryReload(), G_InventoryRemoveItemByID(), G_InventoryToFloor(), G_SendInventory(), GAME_NetSendInventory(), GAME_SaveInventory(), getFirstShapePosition(), INV_LoadWeapon(), INVSH_CheckToInventory_shape(), INVSH_ShapeCheckPosition(), InventoryInterface::moveInInventory(), UI_BaseInventoryNodeGetItem(), and UI_ContainerNodeDrawGrid().
|
inline |
Definition at line 489 of file inv_shared.h.
References _itemDef.
Referenced by Inventory::canHoldItemWeight(), InventoryInterface::moveInInventory(), UI_ContainerNodeAutoPlaceItem(), and UI_ContainerNodeDrawDropPreview().
|
inline |
Definition at line 476 of file inv_shared.h.
References _itemDef.
Referenced by actorL_throwgrenade(), AI_IsHandForForShootTypeFree(), CL_ActorReload(), G_ActorReload(), G_ClientCanReload(), HUD_GetLeftHandWeapon(), HUD_UpdateActorStats(), HUD_UpdateButtons(), and UI_ContainerNodeDrawSingle().
|
inline |
Definition at line 479 of file inv_shared.h.
References _itemDef.
Referenced by CL_GetSkillIndicator(), GAME_LoadItem(), HUD_CheckReload(), HUD_DisplayActions(), HUD_UpdateActor(), and mustReload().
| bool Item::isSameAs | ( | const Item *const | other | ) | const |
Check if the (physical) information of 2 items is exactly the same.
| [in] | other | Second item to compare. |
Definition at line 536 of file inv_shared.cpp.
References ammoDef(), def(), getAmmoLeft(), and Item().
Referenced by InventoryInterface::addToInventory(), and Inventory::findInContainer().
|
inline |
Definition at line 486 of file inv_shared.h.
References _itemDef.
Referenced by AI_GetItemFromInventory(), AI_SearchGrenade(), G_ClientGetWeaponFromInventory(), ReactionFire::getFireDef(), HUD_ReactionFireGetTUs(), HUD_UpdateActorFireMode(), uiContainerNode::onDndFinished(), UI_ContainerNodeAutoPlaceItem(), and UI_GetItemTooltip().
|
inline |
Definition at line 483 of file inv_shared.h.
References getAmmoLeft(), and isReloadable().
Referenced by AI_ActorThink(), AI_GetItemFromInventory(), AI_SearchGrenade(), G_ClientGetWeaponFromInventory(), ReactionFire::getFireDef(), HUD_CheckShooting(), HUD_UpdateActorFireMode(), and UI_DrawItem().
Definition at line 435 of file inv_shared.h.
References _ammoDef.
Referenced by CL_InvAmmo(), CL_InvReload(), CL_NetReceiveItem(), CP_AddWeaponAmmo(), InventoryInterface::EquipActorMelee(), InventoryInterface::EquipActorRobot(), G_ActorInvMove(), G_ReadItem(), GAME_LoadItem(), INV_LoadWeapon(), INV_UnloadWeapon(), Item(), Item(), InventoryInterface::moveInInventory(), InventoryInterface::PackAmmoAndWeapon(), and TEST_F().
Definition at line 441 of file inv_shared.h.
References _ammoLeft.
Referenced by CL_InvAmmo(), CL_InvReload(), CL_NetReceiveItem(), CP_AddWeaponAmmo(), InventoryInterface::EquipActorMelee(), InventoryInterface::EquipActorRobot(), G_ActorInvMove(), G_ClientShoot(), G_ReadItem(), GAME_LoadItem(), INV_LoadWeapon(), INV_UnloadWeapon(), Item(), Item(), InventoryInterface::moveInInventory(), InventoryInterface::PackAmmoAndWeapon(), and TEST_F().
Definition at line 438 of file inv_shared.h.
References _amount.
Referenced by InventoryInterface::addToInventory(), CL_NetReceiveItem(), G_ActorInvMove(), G_ReadItem(), GAME_LoadItem(), Item(), and Item().
Definition at line 444 of file inv_shared.h.
References _itemDef.
Referenced by CL_NetReceiveItem(), G_ActorInvMove(), G_ReadItem(), GAME_LoadItem(), and UI_BaseInventoryNodeDrawItems().
Definition at line 426 of file inv_shared.h.
Referenced by InventoryInterface::addInvList(), InventoryInterface::addToInventory(), and InventoryInterface::removeInvList().
Definition at line 429 of file inv_shared.h.
References _x.
Referenced by InventoryInterface::addToInventory(), G_ActorInvMove(), and InventoryInterface::moveInInventory().
Definition at line 432 of file inv_shared.h.
References _y.
Referenced by InventoryInterface::addToInventory(), G_ActorInvMove(), and InventoryInterface::moveInInventory().
|
private |
Pointer to ammo definition.
Definition at line 404 of file inv_shared.h.
Referenced by ammoDef(), and setAmmoDef().
|
private |
Number of ammo rounds left - see NONE_AMMO
Definition at line 410 of file inv_shared.h.
Referenced by getAmmoLeft(), and setAmmoLeft().
|
private |
The amount of items of this type on the same x and y location in the container
Definition at line 409 of file inv_shared.h.
Referenced by addAmount(), getAmount(), and setAmount().
|
private |
The weapon definition.
Definition at line 403 of file inv_shared.h.
Referenced by def(), isArmour(), isHeldTwoHanded(), isReloadable(), isWeapon(), Item(), Item(), and setDef().
|
private |
|
private |
|
private |
Position (aka origin location) of the item in the container/invlist.
Definition at line 406 of file inv_shared.h.
| int Item::rotated |
If the item is currently displayed rotated (true or 1) or not (false or 0)
Definition at line 412 of file inv_shared.h.
Referenced by InventoryInterface::addToInventory(), CL_NetReceiveItem(), G_ActorInvMove(), G_ReadItem(), G_WriteItem(), GAME_LoadItem(), GAME_NetSendItem(), GAME_SaveItem(), INVSH_CheckToInventory_shape(), INVSH_ShapeCheckPosition(), Item(), Item(), InventoryInterface::moveInInventory(), uiContainerNode::onDndFinished(), InventoryInterface::tryAddToInventory(), UI_ContainerNodeDrawDropPreview(), and UI_DrawItem().