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


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

本文整理汇总了C++中CItem::GetType方法的典型用法代码示例。如果您正苦于以下问题:C++ CItem::GetType方法的具体用法?C++ CItem::GetType怎么用?C++ CItem::GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CItem的用法示例。


在下文中一共展示了CItem::GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetDriveItems

// Gets all items of type IT_DRIVE.
//
void CDirstatDoc::GetDriveItems(CArray<CItem *, CItem *>& drives)
{
    drives.RemoveAll();

    CItem *root = GetRootItem();

    if(NULL == root)
    {
        return;
    }

    if(IT_MYCOMPUTER == root->GetType())
    {
        for(int i = 0; i < root->GetChildrenCount(); i++)
        {
            CItem *drive = root->GetChild(i);
            ASSERT(IT_DRIVE == drive->GetType());
            drives.Add(drive);
        }
    }
    else if(IT_DRIVE == root->GetType())
    {
        drives.Add(root);
    }
}
开发者ID:JDuverge,项目名称:windirstat,代码行数:27,代码来源:dirstatdoc.cpp

示例2: OnUpdateCleanupDelete

void CDirstatDoc::OnUpdateCleanupDelete(CCmdUI *pCmdUI)
{
    // FIXME: Multi-select
    CItem *item = GetSelection(0);

    pCmdUI->Enable(
        DirectoryListHasFocus()
        && item != NULL
        && (IT_DIRECTORY == item->GetType() || IT_FILE == item->GetType())
        && !item->IsRootItem()
    );
}
开发者ID:JDuverge,项目名称:windirstat,代码行数:12,代码来源:dirstatdoc.cpp

示例3: OnCleanupDeletetotrashbin

void CDirstatDoc::OnCleanupDeletetotrashbin()
{
    // FIXME: Multi-select
    CItem *item = GetSelection(0);

    if(NULL == item || item->GetType() != IT_DIRECTORY && item->GetType() != IT_FILE || item->IsRootItem())
    {
        return;
    }

    if(DeletePhysicalItem(item, true))
    {
        RefreshRecyclers();
        UpdateAllViews(NULL);
    }
}
开发者ID:JDuverge,项目名称:windirstat,代码行数:16,代码来源:dirstatdoc.cpp

示例4: FindDefaultDesc

bool CGroupOfDeviceGenerators::FindDefaultDesc (const CItem &Item, SDeviceDesc *retDesc)

//	FindDefaultDesc
//
//	Looks for a slot descriptor that matches the given item and returns it.

	{
	//	See if the item fits into one of the slots that we've defined. If so, 
	//	then we take the descriptor from the slot.

	SSlotDesc *pSlotDesc = FindSlotDesc(Item);
	if (pSlotDesc)
		{
		*retDesc = pSlotDesc->DefaultDesc;
		return true;
		}

	//	Otherwise we go with default (we assume that retDesc is already 
	//	initialized to default values).
	//
	//	For backwards compatibility, however, we place all weapons 20 pixels
	//	forward.

	ItemCategories iCategory = Item.GetType()->GetCategory();
	if (iCategory == itemcatWeapon || iCategory == itemcatLauncher)
		retDesc->iPosRadius = 20;

	//	Done

	return true;
	}
开发者ID:smileyninja,项目名称:Transcendence,代码行数:31,代码来源:CDeviceTable.cpp

示例5: clearTradesFunctor

bool clearTradesFunctor( CBaseObject *a, UI32 &b, void *extraData )
{
	bool retVal = true;
	if( ValidateObject( a ) && a->CanBeObjType( OT_ITEM ) )
	{
		// Body of the functor goes here
		CItem *i = static_cast< CItem * >(a);
		if( ValidateObject( i ) )
		{
			if( i->GetType() == IT_TRADEWINDOW )
			{
				CChar *k = FindItemOwner( i );
				if( ValidateObject( k ) )
				{
					CItem *p = k->GetPackItem();
					if( ValidateObject( p ) )
					{
						CDataList< CItem * > *iCont = i->GetContainsList();
						for( CItem *j = iCont->First(); !iCont->Finished(); j = iCont->Next() )
						{
							if( ValidateObject( j ) )
								j->SetCont( p );
						}
					}
				}
				i->Delete();
				++b;	// let's track how many we cleared
			}
		}
	}
	return retVal;
}
开发者ID:bholtsclaw,项目名称:uox3,代码行数:32,代码来源:trade.cpp

示例6: Cleanup

//o--------------------------------------------------------------------------o
//|	Function		-	Cleanup( void )
//|	Date			-	26th September, 2001
//|	Programmer		-	Abaddon
//|	Modified		-
//o--------------------------------------------------------------------------o
//|	Purpose			-	Makes sure that any items and chars inside the multi
//|						are removed
//o--------------------------------------------------------------------------o
void CMultiObj::Cleanup( void )
{
	for( CItem *iRemove = itemInMulti.First(); !itemInMulti.Finished(); iRemove = itemInMulti.Next() )
	{
		if( ValidateObject( iRemove ) )
		{
			ItemTypes iType = iRemove->GetType();
			if( iType == IT_DOOR || iType == IT_LOCKEDDOOR || iType == IT_HOUSESIGN )
				iRemove->Delete();
			else
			{
				if( iRemove->IsLockedDown() )
					iRemove->SetMovable( 1 );
				iRemove->SetMulti( INVALIDSERIAL );
				iRemove->SetZ( GetZ() );
			}
		}
	}
	for( CChar *cRemove = charInMulti.First(); !charInMulti.Finished(); cRemove = charInMulti.Next() )
	{
		if( ValidateObject( cRemove ) )
		{
			cRemove->SetMulti( INVALIDSERIAL );
			cRemove->SetZ( GetZ() );
		}
	}
	CItem::Cleanup();
}
开发者ID:bholtsclaw,项目名称:uox3,代码行数:37,代码来源:cMultiObj.cpp

示例7: OnCleanupDelete

void CDirstatDoc::OnCleanupDelete()
{
    // FIXME: Multi-select
    CItem *item = GetSelection(0);

    if(NULL == item || item->GetType() != IT_DIRECTORY && item->GetType() != IT_FILE || item->IsRootItem())
    {
        return;
    }

    if(DeletePhysicalItem(item, false))
    {
        SetWorkingItem(GetRootItem());
        UpdateAllViews(NULL);
    }
}
开发者ID:JDuverge,项目名称:windirstat,代码行数:16,代码来源:dirstatdoc.cpp

示例8: OnItemFired

void CPlayerGameStats::OnItemFired (const CItem &Item)

//	OnItemFired
//
//	Player fired the item (weapon or missile)

	{
	SItemTypeStats *pStats = GetItemStats(Item.GetType()->GetUNID());
	pStats->iCountFired++;
	}
开发者ID:Sdw195,项目名称:Transcendence,代码行数:10,代码来源:CPlayerGameStats.cpp

示例9: NPC_CheckWalkHere

bool CChar::NPC_CheckWalkHere( const CPointBase & pt, const CRegionBase * pArea, WORD wBlockFlags ) const
{
	ADDTOCALLSTACK("CChar::NPC_CheckWalkHere");
	UNREFERENCED_PARAMETER(wBlockFlags);
	// Does the NPC want to walk here ? step on this item ?
	if ( !m_pNPC )
		return false;
	if ( !pt.IsValidXY() )
		return true;

	if ( m_pArea != NULL )
	{
		if ( m_pNPC->m_Brain == NPCBRAIN_GUARD && !IsStatFlag(STATF_War) )	// guards will want to stay in guard range
		{
			if ( m_pArea->IsGuarded() && !pArea->IsGuarded() )
				return false;
		}

		if ( Noto_IsCriminal() )
		{
			if ( !m_pArea->IsGuarded() && pArea->IsGuarded() )
				return false;
		}
	}

	// Is there a nasty object here that will hurt us ?
	CWorldSearch AreaItems(pt);
	for (;;)
	{
		CItem * pItem = AreaItems.GetItem();
		if ( pItem == NULL )
			break;

		if ( abs(pItem->GetTopZ() - pt.m_z) > 5 )
			continue;

		switch ( pItem->GetType() )
		{
			case IT_WEB:
				return (GetDispID() == CREID_GIANT_SPIDER) ? true : false;
			case IT_FIRE:
				return Can(CAN_C_FIRE_IMMUNE);
			case IT_TRAP:
			case IT_TRAP_ACTIVE:
			case IT_MOONGATE:
			case IT_TELEPAD:
				return false;
			default:
				break;
		}
	}
	return true;
}
开发者ID:leandrorenato,项目名称:Source,代码行数:53,代码来源:CCharNPCStatus.cpp

示例10: UseItemEx

bool iCHARACTER::UseItemEx(LPITEM item, int iDestCell) {
    switch (item->GetVnum()) {
    case 71051:
    case 71052:
        CItem* useon = this->GetItem(iDestCell);
        if (useon && useon->GetType()==ITEM_COSTUME){
            this->ChatPacket(CHAT_TYPE_INFO,locale_find("¼Ó¼ºÀ» º¯°æÇÒ ¼ö ¾ø´Â ¾ÆÀÌÅÛÀÔ´Ï´Ù."));
            return true;
        }
    }
    return globals::instance()->UseItemEx->GetOriginalFunction()(this, item, iDestCell);
}
开发者ID:JachuPL,项目名称:libgame,代码行数:12,代码来源:iCHARACTER.cpp

示例11: SetSelection

void CTypeView::SetSelection()
{
    // FIXME: Multi-select
    CItem *item = GetDocument()->GetSelection(0);
    if(item == NULL || item->GetType() != IT_FILE)
    {
        m_extensionListControl.EnsureVisible(0, false);
    }
    else
    {
        m_extensionListControl.SelectExtension(item->GetExtension());
    }
}
开发者ID:JDuverge,项目名称:windirstat,代码行数:13,代码来源:typeview.cpp

示例12: 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

示例13: 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

示例14: IsFuelCompatible

bool CReactorClass::IsFuelCompatible (const ReactorDesc &Desc, const CItem &FuelItem)

//	IsFuelCompatible
//
//	Returns TRUE if compatible with the given fuel.

	{
	if (Desc.pFuelCriteria)
		return FuelItem.MatchesCriteria(*Desc.pFuelCriteria);
	else
		{
		//	Must be fuel

		if (!FuelItem.GetType()->IsFuel())
			return false;

		//	Make sure we're the correct level

		int iLevel = FuelItem.GetType()->GetLevel();
		return (iLevel >= Desc.iMinFuelLevel 
				&& iLevel <= Desc.iMaxFuelLevel);
		}
	}
开发者ID:bmer,项目名称:Mammoth,代码行数:23,代码来源:CReactorClass.cpp

示例15: CreateItemFromList

CInstalledArmor *GetArmorSectionArg (CCodeChain &CC, ICCItem *pArg, CSpaceObject *pObj)

//	GetArmorSectionArg
//
//	Returns an armor section from a section number or an item struct
//	Returns NULL if invalid.

	{
	//	Get the ship 

	CShip *pShip = pObj->AsShip();
	if (pShip == NULL)
		return NULL;

	//	Set the armor segment

	int iArmorSeg;
	if (pArg->IsList())
		{
		CItem Item = CreateItemFromList(CC, pArg);
		if (Item.GetType() && Item.GetType()->GetArmorClass() && Item.IsInstalled())
			iArmorSeg = Item.GetInstalled();
		else
			return NULL;
		}
	else
		iArmorSeg = pArg->GetIntegerValue();

	//	Some error checking

	if (iArmorSeg < 0 || iArmorSeg >= pShip->GetArmorSectionCount())
		return NULL;

	//	Done

	return pShip->GetArmorSection(iArmorSeg);
	}
开发者ID:alanhorizon,项目名称:Transcendence,代码行数:37,代码来源:CCUtil.cpp


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