本文整理汇总了C++中CBaseObject::CanBeObjType方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseObject::CanBeObjType方法的具体用法?C++ CBaseObject::CanBeObjType怎么用?C++ CBaseObject::CanBeObjType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseObject
的用法示例。
在下文中一共展示了CBaseObject::CanBeObjType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: subtractItemWeight
//o--------------------------------------------------------------------------o
//| Function - void CWeight::subtractItemWeight( CItem *pack, CItem *item )
//| Date - 2/23/2003
//| Developers - Zane
//| Organization - UOX3 DevTeam
//o--------------------------------------------------------------------------o
//| Description - Subtracts an items weight from the total weight of the pack updating
//| the packs container in the process
//o--------------------------------------------------------------------------o
void CWeight::subtractItemWeight( CItem *pack, CItem *item )
{
SI32 totalWeight = pack->GetWeight();
if( calcSubtractWeight( item, totalWeight ) )
pack->SetWeight( totalWeight, false );
else
pack->SetWeight( 0, false );
CBaseObject *pCont = pack->GetCont();
if( ValidateObject( pCont ) )
{
if( pCont->CanBeObjType( OT_ITEM ) )
{
CItem *pPack = static_cast<CItem *>(pCont);
if( ValidateObject( pPack ) )
subtractItemWeight( pPack, item );
}
else
{
CChar *packOwner = static_cast<CChar *>(pCont);
if( ValidateObject( packOwner ) )
{
if( IsWeightedContainer( pack ) )
subtractItemWeight( packOwner, item );
}
}
}
}