本文整理汇总了C++中CInventory::RemoveItem方法的典型用法代码示例。如果您正苦于以下问题:C++ CInventory::RemoveItem方法的具体用法?C++ CInventory::RemoveItem怎么用?C++ CInventory::RemoveItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInventory
的用法示例。
在下文中一共展示了CInventory::RemoveItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnRecordedGameplayEvent
//.........这里部分代码省略.........
if(demo_forceGameState == 2 && pClass)
pInventory->AddAccessory(pClass);// doesn't actually add it if it's there already
}
}
}
break;
case eGE_ItemDropped:
{
TItemName sel = (TItemName)event.description;
//gstate.itemSelected = sel;
TItemContainer& Items = gstate.Items;
TItemContainer::iterator it = Items.find(sel);
if(it != Items.end())
{
it->second.count--;
if(it->second.count<=0)
Items.erase(it);
if(demo_forceGameState == 2)
{
CActor *pActor = (CActor*)(gEnv->pGame->GetIGameFramework()->GetIActorSystem()->GetActor(id));
if(pActor)
{
CInventory* pInventory = (CInventory*)(pActor->GetInventory());
if(pInventory)
{
IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(sel);
if(pClass)
{
EntityId itemId = pInventory->GetItemByClass(pClass);
if(itemId)
pInventory->RemoveItem(itemId);
}
}
}
}
}
else
GameWarning("TimeDemo:GameState: Frame %d - Actor %s - ITEM DROPPED, wrong item selected (%s)",m_currentFrame,pEntity->GetName(),sel);
}
break;
case eGE_AmmoCount:
{
TItemContainer& Items = gstate.Items;
TItemName itemClassDesc = event.description;
TItemContainer::iterator it = Items.find(itemClassDesc);
if(it != Items.end())
{
SItemProperties& item = it->second;
const char* ammoClassDesc = (const char*)(event.extra);
if(ammoClassDesc)
{
string szAmmoClassDesc(ammoClassDesc);
bool bAmmoMag = IsAmmoGrenade(ammoClassDesc);
TAmmoContainer& itemAmmo = bAmmoMag ? gstate.AmmoMags : item.Ammo;
if(itemAmmo.find(szAmmoClassDesc)==itemAmmo.end())
itemAmmo.insert(std::make_pair(szAmmoClassDesc,int(event.value)));
else
itemAmmo[szAmmoClassDesc] = (uint16)event.value;
if(!bRecording && (m_bLogWarning || demo_forceGameState==2))
{