本文整理汇总了C++中CItem::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CItem::GetCount方法的具体用法?C++ CItem::GetCount怎么用?C++ CItem::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CItem
的用法示例。
在下文中一共展示了CItem::GetCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnItemSold
void CPlayerGameStats::OnItemSold (const CItem &Item, CurrencyValue iTotalPrice)
// OnItemSold
//
// Player sold an item
{
if (iTotalPrice <= 0)
return;
SItemTypeStats *pStats = GetItemStats(Item.GetType()->GetUNID());
pStats->iCountSold += Item.GetCount();
pStats->iValueSold += iTotalPrice;
}
示例2: OnItemBought
void CPlayerGameStats::OnItemBought (const CItem &Item, CurrencyValue iTotalPrice)
// OnItemBought
//
// Player bought an item
{
if (iTotalPrice <= 0)
return;
SItemTypeStats *pStats = GetItemStats(Item.GetType()->GetUNID());
pStats->iCountBought += Item.GetCount();
pStats->iValueBought += iTotalPrice;
}
示例3: AddClassInfo
void CNewGameSession::AddClassInfo (CShipClass *pClass, const CDeviceDescList &Devices, const CItem &Item, int x, int y, int cxWidth, DWORD dwOptions, int *retcyHeight, IAnimatron **retpAni)
// AddClassInfo
//
// Creates a new class info item animation
{
CUIHelper Helper(m_HI);
// For special item info, such as reactors, drives, etc., we encode a
// special code in the item count.
switch (Item.GetCount())
{
case SPECIAL_ARMOR:
Helper.CreateClassInfoArmor(pClass, x, y, cxWidth, dwOptions, retcyHeight, retpAni);
break;
case SPECIAL_CARGO:
Helper.CreateClassInfoCargo(pClass, Devices, x, y, cxWidth, dwOptions, retcyHeight, retpAni);
break;
case SPECIAL_DEVICE_SLOTS:
Helper.CreateClassInfoDeviceSlots(pClass, Devices, x, y, cxWidth, dwOptions, retcyHeight, retpAni);
break;
case SPECIAL_DRIVE:
Helper.CreateClassInfoDrive(pClass, Devices, x, y, cxWidth, dwOptions, retcyHeight, retpAni);
break;
case SPECIAL_REACTOR:
Helper.CreateClassInfoReactor(pClass, Devices, x, y, cxWidth, dwOptions, retcyHeight, retpAni);
break;
default:
Helper.CreateClassInfoItem(Item, x, y, cxWidth, dwOptions, NULL_STR, retcyHeight, retpAni);
}
}
示例4: GenerateGameStats
//.........这里部分代码省略.........
sSort);
}
// Stats for player equipment (but only if the game is done)
if (bGameOver)
{
TSortMap<CString, CItem> InstalledItems;
// First we generate a sorted list of installed items
// (We do this in case there are multiple of the same device/armor so that
// we can coalesce them together into a single line).
CItemListManipulator ItemList(pShip->GetItemList());
ItemList.ResetCursor();
while (ItemList.MoveCursorForward())
{
const CItem &Item(ItemList.GetItemAtCursor());
if (Item.IsInstalled())
{
CString sEnhancement = Item.GetEnhancedDesc(pShip);
CString sItemName = Item.GetNounPhrase(nounActual | nounCountOnly | nounShort);
CString sLine = (sEnhancement.IsBlank() ? sItemName : strPatternSubst(CONSTLIT("%s [%s]"), sItemName, sEnhancement));
bool bInserted;
CItem *pEntry = InstalledItems.SetAt(sLine, &bInserted);
if (bInserted)
{
*pEntry = Item;
pEntry->SetCount(1);
}
else
pEntry->SetCount(pEntry->GetCount() + 1);
}
}
// Now add all the installed items to the stats
for (j = 0; j < InstalledItems.GetCount(); j++)
{
// Redo the line now that we know the proper count
CString sEnhancement = InstalledItems[j].GetEnhancedDesc(pShip);
CString sItemName = InstalledItems[j].GetNounPhrase(nounActual | nounCountOnly);
CString sLine = (sEnhancement.IsBlank() ? sItemName : strPatternSubst(CONSTLIT("%s [%s]"), sItemName, sEnhancement));
// Compute the sort order
int iOrder;
switch (InstalledItems[j].GetType()->GetCategory())
{
case itemcatWeapon:
iOrder = 0;
break;
case itemcatLauncher:
iOrder = 1;
break;
case itemcatShields:
iOrder = 2;
break;
case itemcatArmor:
iOrder = 3;