Josh Matthews wrote:
Actually, I'm still confused about how the classname method won't
work.  When it reaches the light entity, it'll trigger correctly and
do its thing.  Then it moves on, can't find any more entities so it
skips to searching for light_spot.  In this case, pEnt will be NULL so
it'll be starting from the beginning all over again, isn't it?

Ah, okay. I didn't notice that you aren't switching states after each match, but only after you get a NULL for the match.

Yes, that should do essentially the same as 3 separate searches since
you are looping through all entities to the end (and setting the pEnt
pointer to NULL) for each state.

So, it appears that both of your examples should return entities.

You may just want to forgo the UTIL code and loop through them yourself...

edict_t *pEdict = g_engfuncs.pfnPEntityOfEntIndex( 1 );
CBaseEntity *pEntity = NULL;

for ( int i = 1; i < gpGlobals->maxEntities; i++, pEdict++ )
{
   if ( pEdict->free )       // skip if not in use
      continue;

   pEntity = CBaseEntity::Instance(pEdict);
   if ( !pEntity )
      continue;  // skip if NULL entity

   if ((FStrEq(pEntity->classname, "light") ||
       (FStrEq(pEntity->classname, "light_spot") ||
       (FStrEq(pEntity->classname, "light_environment"))
   {
      // do light stuff here
   }
}

--
Jeffrey "botman" Broome

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Reply via email to