| 1020 | } |
| 1021 | |
| 1022 | bool 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 | |
| 1043 | u32 CInventory::BeltSlotsCount() const |
| 1044 | { |
no test coverage detected