本文整理汇总了C++中ItemInstance::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ ItemInstance::GetType方法的具体用法?C++ ItemInstance::GetType怎么用?C++ ItemInstance::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemInstance
的用法示例。
在下文中一共展示了ItemInstance::GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SortBufferBagItems
Void Inventory::SortBufferBagItems()
{
if ( m_arrBags[INVENTORYBAGID_BUFFER].iFreeSlots == INVENTORY_BAG_SIZE )
return;
for( UInt i = 0; i < INVENTORY_BAG_SIZE; ++i ) {
ItemInstance * pItemInstance = m_arrBags[INVENTORYBAGID_BUFFER].arrSlots[i];
if ( pItemInstance == NULL )
continue;
InventoryBagID idTargetBag = INVENTORYBAGID_COUNT;
switch( pItemInstance->GetType() ) {
case ITEMTYPE_BLOCK: idTargetBag = INVENTORYBAGID_BLOCK; break;
case ITEMTYPE_EQUIPMENT: idTargetBag = INVENTORYBAGID_EQUIPMENT; break;
case ITEMTYPE_CONSUMABLE: idTargetBag = INVENTORYBAGID_CONSUMABLE; break;
case ITEMTYPE_QUEST: idTargetBag = INVENTORYBAGID_QUEST; break;
default: Assert(false); break;
}
if ( m_arrBags[idTargetBag].iFreeSlots == 0 )
continue;
UInt iFreeSlot = _Bag_GetFreeSlot( idTargetBag );
Assert( m_arrBags[idTargetBag].arrSlots[iFreeSlot] == NULL );
m_arrBags[INVENTORYBAGID_BUFFER].arrSlots[i] = NULL;
m_arrBags[idTargetBag].arrSlots[iFreeSlot] = pItemInstance;
++(m_arrBags[INVENTORYBAGID_BUFFER].iFreeSlots);
--(m_arrBags[idTargetBag].iFreeSlots);
}
SortBag( INVENTORYBAGID_BUFFER );
}