本文整理汇总了C++中CChar::GetRegion方法的典型用法代码示例。如果您正苦于以下问题:C++ CChar::GetRegion方法的具体用法?C++ CChar::GetRegion怎么用?C++ CChar::GetRegion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChar
的用法示例。
在下文中一共展示了CChar::GetRegion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: r_Verb
bool CRegionBase::r_Verb( CScript & s, CTextConsole * pSrc ) // Execute command from script
{
ADDTOCALLSTACK("CRegionBase::r_Verb");
EXC_TRY("Verb");
LPCTSTR pszKey = s.GetKey();
if ( !strnicmp(pszKey, "CLEARTAGS", 9) )
{
pszKey = s.GetArgStr();
SKIP_SEPARATORS(pszKey);
m_TagDefs.ClearKeys(pszKey);
return true;
}
int index = FindTableSorted( pszKey, sm_szVerbKeys, COUNTOF( sm_szVerbKeys )-1 );
switch (index)
{
case RV_ALLCLIENTS:
{
ClientIterator it;
for (CClient* pClient = it.next(); pClient != NULL; pClient = it.next())
{
CChar * pChar = pClient->GetChar();
if ( !pChar || ( pChar->GetRegion() != this ))
continue;
CScript script( s.GetArgStr() );
pChar->r_Verb(script, pSrc);
}
return true;
}
case RV_TAGLIST:
{
m_TagDefs.DumpKeys( pSrc, "TAG." );
return true;
}
default:
break;
}
if ( index < 0 )
{
index = FindTableSorted(s.GetKey(), CSector::sm_szVerbKeys, SEV_QTY);
if ( index >= 0 )
return SendSectorsVerb(s.GetKey(), s.GetArgRaw(), pSrc);
}
return CScriptObj::r_Verb(s, pSrc);
EXC_CATCH;
EXC_DEBUG_START;
g_Log.EventDebug("command '%s' args '%s' [%p]\n", s.GetKey(), s.GetArgRaw(), static_cast<void *>(pSrc));
EXC_DEBUG_END;
return false;
}
示例2: GenerateChar
void CItemSpawn::GenerateChar(CResourceDef * pDef)
{
ADDTOCALLSTACK("CitemSpawn:GenerateChar");
if ( !IsTopLevel() || ( m_itSpawnChar.m_current >= GetAmount() ) || ( GetTopSector()->GetCharComplexity() > 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);
size_t i = pSpawnGroup->GetRandMemberIndex();
if ( i != pSpawnGroup->BadMemberIndex() )
{
rid = pSpawnGroup->GetMemberID(i);
}
}
if (( rid.GetResType() != RES_CHARDEF ) && ( rid.GetResType() != RES_UNKNOWN ))
return;
CREID_TYPE id = static_cast<CREID_TYPE>(rid.GetResIndex());
bool isBadPlaceToSpawn = false;
CChar * pChar = CChar::CreateBasic(id);
if( pChar == NULL )
{
return;
}
pChar->NPC_LoadScript(true);
AddObj(pChar->GetUID());
pChar->m_uidSpawnItem = GetUID(); // SpawnItem for this char
pChar->StatFlag_Set( STATF_Spawned );
pChar->MoveTo(GetTopPoint());
pChar->NPC_CreateTrigger(); //Removed from NPC_LoadScript() and triggered after char placement
if( pChar->GetRegion() == NULL )
{
isBadPlaceToSpawn = true;
}
else if( pChar->GetRegion()->IsGuarded() && pChar->Noto_IsEvil() )
{
isBadPlaceToSpawn = true;
}
// Deny definitely known a bad place to spawn (like red NPCs in guarded areas)
// Usually caused by wide range near the edge of the towns
if( isBadPlaceToSpawn )
{
pChar->Delete();
//m_itSpawnChar.m_current--;
return;
}
ASSERT(pChar->m_pNPC);
if ( iDistMax )
{
pChar->m_ptHome = GetTopPoint();
pChar->m_pNPC->m_Home_Dist_Wander = static_cast<WORD>(iDistMax);
}
pChar->Update();
}