TRIGRET_TYPE CRegionBase::OnRegionTrigger( CTextConsole * pSrc, RTRIG_TYPE iAction ) { ADDTOCALLSTACK("CRegionBase::OnRegionTrigger"); // RETURN: true = halt prodcessing (don't allow in this region TRIGRET_TYPE iRet; for ( size_t i = 0; i < m_Events.GetCount(); ++i ) { CResourceLink * pLink = m_Events[i]; if ( !pLink || ( pLink->GetResType() != RES_REGIONTYPE ) || !pLink->HasTrigger(iAction) ) continue; CResourceLock s; if ( pLink->ResourceLock(s) ) { iRet = CScriptObj::OnTriggerScript(s, sm_szTrigName[iAction], pSrc); if ( iRet == TRIGRET_RET_TRUE ) return iRet; } } // EVENTSREGION triggers (constant events of regions set from sphere.ini) for ( size_t i = 0; i < g_Cfg.m_pEventsRegionLink.GetCount(); ++i ) { CResourceLink * pLink = g_Cfg.m_pEventsRegionLink[i]; if ( !pLink || ( pLink->GetResType() != RES_REGIONTYPE ) || !pLink->HasTrigger(iAction) ) continue; CResourceLock s; if ( !pLink->ResourceLock(s) ) continue; iRet = CScriptObj::OnTriggerScript(s, sm_szTrigName[iAction], pSrc); if ( iRet != TRIGRET_RET_FALSE && iRet != TRIGRET_RET_DEFAULT ) return iRet; } return TRIGRET_RET_DEFAULT; }
const CRandGroupDef * CRegionWorld::FindNaturalResource(int type) const { ADDTOCALLSTACK("CRegionWorld::FindNaturalResource"); // Find the natural resources assinged to this region. // ARGS: type = IT_TYPE for ( size_t i = 0; i < m_Events.GetCount(); i++ ) { CResourceLink * pLink = m_Events[i]; if ( !pLink || ( pLink->GetResType() != RES_REGIONTYPE )) continue; if ( pLink->GetResPage() == type ) return (dynamic_cast <const CRandGroupDef *>(pLink)); } return NULL; }