本文整理汇总了C++中CChar::Memory_AddObjTypes方法的典型用法代码示例。如果您正苦于以下问题:C++ CChar::Memory_AddObjTypes方法的具体用法?C++ CChar::Memory_AddObjTypes怎么用?C++ CChar::Memory_AddObjTypes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChar
的用法示例。
在下文中一共展示了CChar::Memory_AddObjTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Spawn_GenerateChar
void CItem::Spawn_GenerateChar( CResourceDef * pDef )
{
if ( ! IsTopLevel())
return; // creatures can only be top level.
if ( m_itSpawnChar.m_current >= GetAmount())
return;
int iComplexity = GetTopSector()->GetCharComplexity();
if ( iComplexity > g_Cfg.m_iMaxCharComplexity )
{
DEBUG_MSG(( "Spawn uid=0%lx too complex (%d>%d)\n", GetUID(), iComplexity, g_Cfg.m_iMaxCharComplexity ));
return;
}
int iDistMax = m_itSpawnChar.m_DistMax;
RESOURCE_ID_BASE rid = pDef->GetResourceID();
if ( rid.GetResType() == RES_SPAWN )
{
const CRandGroupDef * pSpawnGroup = STATIC_CAST <const CRandGroupDef *>(pDef);
ASSERT(pSpawnGroup);
int i = pSpawnGroup->GetRandMemberIndex();
if ( i >= 0 )
{
rid = pSpawnGroup->GetMemberID(i);
}
}
CREID_TYPE id;
if ( rid.GetResType() == RES_CHARDEF ||
rid.GetResType() == RES_UNKNOWN )
{
id = (CREID_TYPE) rid.GetResIndex();
}
else
{
return;
}
CChar * pChar = CChar::CreateNPC( id );
if ( pChar == NULL )
return;
ASSERT(pChar->m_pNPC);
m_itSpawnChar.m_current ++;
pChar->Memory_AddObjTypes( this, MEMORY_ISPAWNED );
// Move to spot "near" the spawn item.
pChar->MoveNearObj( this, iDistMax );
if ( iDistMax )
{
pChar->m_ptHome = GetTopPoint();
pChar->m_pNPC->m_Home_Dist_Wander = iDistMax;
}
pChar->Update();
}
示例2:
CStoneMember::CStoneMember( CItemStone * pStone, CGrayUID uid, STONEPRIV_TYPE iType, LPCTSTR pTitle, CGrayUID loyaluid, bool fVal1, bool fVal2, int nAccountGold)
{
m_uidLinkTo = uid;
m_sTitle = pTitle;
m_iPriv = iType;
m_uidLoyalTo = loyaluid;
// union.
if ( iType == STONEPRIV_ENEMY )
{
m_Enemy.m_fTheyDeclared = fVal1;
m_Enemy.m_fWeDeclared = fVal2;
}
else
{
m_Member.m_fAbbrev = fVal1;
m_Member.m_iVoteTally = fVal2; // Temporary space to calculate votes.
}
m_Member.m_iAccountGold = nAccountGold;
if ( ! g_Serv.IsLoading() && pStone->GetMemoryType())
{
CChar * pChar = uid.CharFind();
if ( pChar != NULL )
{
pChar->Memory_AddObjTypes(pStone, static_cast<WORD>(pStone->GetMemoryType()));
if ( pStone->IsTopLevel())
{
pChar->m_ptHome = pStone->GetTopPoint(); // Our new home.
}
}
}
pStone->InsertTail( this );
}