components/prboom/p_map.c
// phares 3/16/98
//
// P_AddSecnode() searches the current list to see if this sector is
// already there. If not, it adds a sector node at the head of the list of
// sectors this object appears in. This is called when creating a list of
// nodes that will get linked in later. Returns a pointer to the new node.
phares 3/16/98
P_AddSecnode() searches the current list to see if this sector is
already there. If not, it adds a sector node at the head of the list of
sectors this object appears in. This is called when creating a list of
nodes that will get linked in later. Returns a pointer to the new node.
phares 3 / 16 / 98 P_AddSecnode () searches the current list to see if this sector is already there . If not it adds a sector node at the head of the list of sectors this object appears in . This is called when creating a list of nodes that will get linked in later . Returns a pointer to the new node .
msecnode_t* P_AddSecnode(sector_t* s, mobj_t* thing, msecnode_t* nextnode)
  {
  msecnode_t* node;
  node = nextnode;
  while (node)
    {
    if (node->m_sector == s)   
      {
      node->m_thing = thing; 
      return(nextnode);
      }
    node = node->m_tnext;
    }
  node = P_GetSecnode();
  node->visited = 0;
  node->m_sector = s;       
  node->m_thing  = thing;     
  node->m_tprev  = NULL;    
  node->m_tnext  = nextnode;  
  if (nextnode)
    nextnode->m_tprev = node; 
  node->m_sprev  = NULL;    
  node->m_snext  = s->touching_thinglist; 
  if (s->touching_thinglist)
    node->m_snext->m_sprev = node;
  s->touching_thinglist = node;
  return(node);
  }
msecnode_t * P_AddSecnode ( sector_t * s , mobj_t * thing , msecnode_t * nextnode ) { msecnode_t * node ; node = nextnode ; while ( node ) { if ( node -> m_sector == s ) { node -> m_thing = thing ; return ( nextnode ) ; } node = node -> m_tnext ; } node = P_GetSecnode ( ) ; node -> visited = 0 ; node -> m_sector = s ; node -> m_thing = thing ; node -> m_tprev = NULL ; node -> m_tnext = nextnode ; if ( nextnode ) nextnode -> m_tprev = node ; node -> m_sprev = NULL ; node -> m_snext = s -> touching_thinglist ; if ( s -> touching_thinglist ) node -> m_snext -> m_sprev = node ; s -> touching_thinglist = node ; return ( node ) ; }
phares 3/16/98
P_AddSecnode() searches the current list to see if this sector is
already there.
phares 3 / 16 / 98 P_AddSecnode () searches the current list to see if this sector is already there .
// Already have a node for this sector? // Yes. Setting m_thing says 'keep it'. // Couldn't find an existing node for this sector. Add one at the head // of the list. // killough 4/4/98, 4/7/98: mark new nodes unvisited. // sector // mobj // prev node on Thing thread // next node on Thing thread // set back link on Thing // Add new node at head of sector thread starting at s->touching_thinglist // prev node on sector thread // next node on sector thread