本文整理汇总了C++中CContainer::OnWeightChange方法的典型用法代码示例。如果您正苦于以下问题:C++ CContainer::OnWeightChange方法的具体用法?C++ CContainer::OnWeightChange怎么用?C++ CContainer::OnWeightChange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CContainer
的用法示例。
在下文中一共展示了CContainer::OnWeightChange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ADDTOCALLSTACK
void CItemContainer::OnWeightChange( int iChange )
{
ADDTOCALLSTACK("CItemContainer::OnWeightChange");
CContainer::OnWeightChange( iChange );
UpdatePropertyFlag(AUTOTOOLTIP_FLAG_WEIGHT);
if ( iChange == 0 )
return; // no change
// some containers do not add weight to you.
if ( ! IsWeighed())
return;
// Propagate the weight change up the stack if there is one.
CContainer * pCont = dynamic_cast <CContainer*>(GetParent());
if ( pCont == NULL )
return; // on ground.
pCont->OnWeightChange( iChange );
}
示例2: SetPropertyNum
void CCPropsItemChar::SetPropertyNum(int iPropIndex, PropertyValNum_t iVal, CObjBase* pLinkedObj, RESDISPLAY_VERSION iLimitToExpansion, bool fDeleteZero)
{
ADDTOCALLSTACK("CCPropsItemChar::SetPropertyNum");
ASSERT(!IsPropertyStr(iPropIndex));
ASSERT((iLimitToExpansion >= RDS_PRET2A) && (iLimitToExpansion < RDS_QTY));
if ((fDeleteZero && (iVal == 0)) || (_iPropertyExpansion[iPropIndex] > iLimitToExpansion))
{
if (0 == _mPropsNum.erase(iPropIndex))
return; // I didn't have this property, so avoid further processing.
}
else
_mPropsNum[iPropIndex] = iVal;
if (!pLinkedObj)
return;
// Do stuff to the pLinkedObj
switch (iPropIndex)
{
case PROPITCH_WEIGHTREDUCTION:
{
CItem *pItemLink = static_cast<CItem*>(pLinkedObj);
int oldweight = pItemLink->GetWeight();
CContainer * pCont = dynamic_cast <CContainer*> (pItemLink->GetParent());
if (pCont)
{
ASSERT(pItemLink->IsItemEquipped() || pItemLink->IsItemInContainer());
pCont->OnWeightChange(pItemLink->GetWeight() - oldweight);
pLinkedObj->UpdatePropertyFlag();
}
break;
}
//default:
// pLinkedObj->UpdatePropertyFlag();
// break;
}
}