MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / CanTakeItem

Method CanTakeItem

ogsr_engine/xrGame/Inventory.cpp:1022–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1020}
1021
1022bool CInventory::CanTakeItem(CInventoryItem* inventory_item) const
1023{
1024 if (inventory_item->object().getDestroy())
1025 return false;
1026
1027 if (!inventory_item->CanTake())
1028 return false;
1029
1030 for (TIItemContainer::const_iterator it = m_all.begin(); it != m_all.end(); it++)
1031 if ((*it)->object().ID() == inventory_item->object().ID())
1032 break;
1033 VERIFY3(it == m_all.end(), "item already exists in inventory", *inventory_item->object().cName());
1034
1035 CActor* pActor = smart_cast<CActor*>(m_pOwner);
1036 //актер всегда может взять вещь
1037 if (!pActor && (TotalWeight() + inventory_item->Weight() > m_pOwner->MaxCarryWeight()))
1038 return false;
1039
1040 return true;
1041}
1042
1043u32 CInventory::BeltSlotsCount() const
1044{

Callers 6

OnEventMethod · 0.80
OnEventMethod · 0.80
OnEventMethod · 0.80
usefulMethod · 0.80
OnEventMethod · 0.80
OnEventMethod · 0.80

Calls 7

MaxCarryWeightMethod · 0.80
objectMethod · 0.45
CanTakeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
cNameMethod · 0.45
WeightMethod · 0.45

Tested by

no test coverage detected