//------------------------------------------------------------------------ int CInventory::GetCountOfCategory(const char *categoryName) const { IItemSystem *pItemSystem = gEnv->pGame->GetIGameFramework()->GetIItemSystem(); int count = 0; TInventoryCIt end = m_stats.slots.end(); for (TInventoryCIt it = m_stats.slots.begin(); it != end; ++it) { IItem *pItem = pItemSystem->GetItem(*it); if (pItem) { const char *cat = pItemSystem->GetItemCategory(pItem->GetEntity()->GetClass()->GetName()); if (!strcmp(cat, categoryName)) count++; } } TInventoryVectorEx::const_iterator endEx = m_stats.accessorySlots.end(); for (TInventoryVectorEx::const_iterator cit = m_stats.accessorySlots.begin(); cit!=endEx; ++cit) { const char *cat = pItemSystem->GetItemCategory((*cit)->GetName()); if (!strcmp(cat,categoryName)) count++; } return count; }