dlls/entitylist.cpp
1090109110921093109410951096
return best_ent;
}
void CGlobalEntityList::OnAddEntity( IHandleEntity *pEnt, CBaseHandle handle )
{
int i = handle.GetEntryIndex();
10901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205
return best_ent;
}
// --> Mirv: New useful method
//-----------------------------------------------------------------------------
// Purpose: Iterates through the entities for ones with the same target
// Input : pStartEntity - Last entity found, NULL to start a new iteration.
// pOwner - Owner to compare with
//-----------------------------------------------------------------------------
CBaseEntity *CGlobalEntityList::FindEntityByOwner(CBaseEntity *pStartEntity, const CBaseEntity *pOwner)
{
const CEntInfo *pInfo = pStartEntity ? GetEntInfoPtr(pStartEntity->GetRefEHandle())->m_pNext : FirstEntInfo();
for (; pInfo; pInfo = pInfo->m_pNext)
{
CBaseEntity *pEntity = (CBaseEntity *) pInfo->m_pEntity;
if (!pEntity)
{
DevWarning("NULL entity in global entity list!\n");
continue;
}
if (pEntity->GetOwnerEntity() == pOwner)
return pEntity;
}
return NULL;
}
// <-- Mirv: New useful method
// --> Mulch
//-----------------------------------------------------------------------------
// Purpose: Iterates through the entities for ones where Classify() == szClassT
// Input : pStartEntity - Last entity found, NULL to start a new iteration.
// szClassT - Class_T we're looking for
//-----------------------------------------------------------------------------
CBaseEntity *CGlobalEntityList::FindEntityByClassT( CBaseEntity *pStartEntity, int szClassT )
{
const CEntInfo *pInfo = pStartEntity ? GetEntInfoPtr( pStartEntity->GetRefEHandle() )->m_pNext : FirstEntInfo();
for( ; pInfo; pInfo = pInfo->m_pNext )
{
CBaseEntity *pEntity = ( CBaseEntity * )pInfo->m_pEntity;
if( !pEntity )
{
DevWarning( "NULL entity in global entity list!\n" );
continue;
}
if( pEntity->Classify() == szClassT )
return pEntity;
}
return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Iterates through the entities finding one where pOwner & szClassname match
// Input : pStartEntity - Last entity found, NULL to start a new iteration.
// pOwner - owner we're looking for
// szClassname - class name we're looking for
//-----------------------------------------------------------------------------
CBaseEntity *CGlobalEntityList::FindEntityByOwnerAndClassname( CBaseEntity *pStartEntity, const CBaseEntity *pOwner, const char *szClassname )
{
const CEntInfo *pInfo = pStartEntity ? GetEntInfoPtr( pStartEntity->GetRefEHandle() )->m_pNext : FirstEntInfo();
for( ; pInfo; pInfo = pInfo->m_pNext )
{
CBaseEntity *pEntity = ( CBaseEntity * )pInfo->m_pEntity;
if( !pEntity )
{
DevWarning( "NULL entity in global entity list!\n" );
continue;
}
if( ( pEntity->GetOwnerEntity() == pOwner ) && ( pEntity->ClassMatches( szClassname ) ) )
return pEntity;
}
return NULL;
}
//-----------------------------------------------------------------------------
// Purpose: Iterates through the entities finding one where pOwner & szClassT match
// Input : pStartEntity - Last entity found, NULL to start a new iteration.
// pOwner - owner we're looking for
// szClassname - class name we're looking for
//-----------------------------------------------------------------------------
CBaseEntity *CGlobalEntityList::FindEntityByOwnerAndClassT( CBaseEntity *pStartEntity, const CBaseEntity *pOwner, int szClassT )
{
const CEntInfo *pInfo = pStartEntity ? GetEntInfoPtr( pStartEntity->GetRefEHandle() )->m_pNext : FirstEntInfo();
for( ; pInfo; pInfo = pInfo->m_pNext )
{
CBaseEntity *pEntity = ( CBaseEntity * )pInfo->m_pEntity;
if( !pEntity )
{
DevWarning( "NULL entity in global entity list!\n" );
continue;
}
if( ( pEntity->GetOwnerEntity() == pOwner ) && ( pEntity->Classify() == szClassT ) )
return pEntity;
}
return NULL;
}
// <-- Mulch
void CGlobalEntityList::OnAddEntity( IHandleEntity *pEnt, CBaseHandle handle )
{
int i = handle.GetEntryIndex();
1500150115021503150415051506
g_EntityListSystem.m_bRespawnAllEntities = true;
}
static ConCommand restart_entities( "respawn_entities", RespawnEntities, "Respawn all the entities in the map." );
class CSortedEntityList
{
16091610161116121613161416151616
g_EntityListSystem.m_bRespawnAllEntities = true;
}
// Jiggles: No, this crashes the hell out of FF
//static ConCommand restart_entities( "respawn_entities", RespawnEntities, "Respawn all the entities in the map." );
class CSortedEntityList
{