components/prboom/p_tick.c
//
// killough 8/29/98:
//
// We maintain separate threads of friends and enemies, to permit more
// efficient searches.
//
killough 8/29/98:
We maintain separate threads of friends and enemies, to permit more
efficient searches.
killough 8 / 29 / 98 : We maintain separate threads of friends and enemies to permit more efficient searches .
void P_UpdateThinker(thinker_t *thinker)
{
  register thinker_t *th;
  int class =
    thinker->function == P_RemoveThinkerDelayed ? th_delete :
    thinker->function == P_MobjThinker &&
    ((mobj_t *) thinker)->health > 0 &&
    (((mobj_t *) thinker)->flags & MF_COUNTKILL ||
     ((mobj_t *) thinker)->type == MT_SKULL) ?
    ((mobj_t *) thinker)->flags & MF_FRIEND ?
    th_friends : th_enemies : th_misc;
  {
    if ((th = thinker->cnext)!= NULL)
      (th->cprev = thinker->cprev)->cnext = th;
  }
  th = &thinkerclasscap[class];
  th->cprev->cnext = thinker;
  thinker->cnext = th;
  thinker->cprev = th->cprev;
  th->cprev = thinker;
}
void P_UpdateThinker ( thinker_t * thinker ) { register thinker_t * th ; int class = thinker -> function == P_RemoveThinkerDelayed ? th_delete : thinker -> function == P_MobjThinker && ( ( mobj_t * ) thinker ) -> health > 0 && ( ( ( mobj_t * ) thinker ) -> flags & MF_COUNTKILL || ( ( mobj_t * ) thinker ) -> type == MT_SKULL ) ? ( ( mobj_t * ) thinker ) -> flags & MF_FRIEND ? th_friends : th_enemies : th_misc ; { if ( ( th = thinker -> cnext ) != NULL ) ( th -> cprev = thinker -> cprev ) -> cnext = th ; } th = & thinkerclasscap [ class ] ; th -> cprev -> cnext = thinker ; thinker -> cnext = th ; thinker -> cprev = th -> cprev ; th -> cprev = thinker ; }
killough 8/29/98:
We maintain separate threads of friends and enemies, to permit more
efficient searches.
killough 8 / 29 / 98 : We maintain separate threads of friends and enemies to permit more efficient searches .
// find the class the thinker belongs to /* Remove from current thread, if in one */ // Add to appropriate thread