当前位置: 首页>>代码示例>>C++>>正文


C++ CItem::GetCount方法代码示例

本文整理汇总了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;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:14,代码来源:CPlayerGameStats.cpp

示例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;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:14,代码来源:CPlayerGameStats.cpp

示例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);
		}
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:38,代码来源:CNewGameSession.cpp

示例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;
开发者ID:Sdw195,项目名称:Transcendence,代码行数:67,代码来源:CPlayerGameStats.cpp


注:本文中的CItem::GetCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。