MCPcopy Create free account
hub / github.com/Farama-Foundation/ViZDoom / P_AddSecnode

Function P_AddSecnode

src/vizdoom/src/p_map.cpp:5689–5732  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5687//=============================================================================
5688
5689msecnode_t *P_AddSecnode(sector_t *s, AActor *thing, msecnode_t *nextnode)
5690{
5691 msecnode_t *node;
5692
5693 if (s == 0)
5694 {
5695 I_FatalError("AddSecnode of 0 for %s\n", thing->_StaticType.TypeName.GetChars());
5696 }
5697
5698 node = nextnode;
5699 while (node)
5700 {
5701 if (node->m_sector == s) // Already have a node for this sector?
5702 {
5703 node->m_thing = thing; // Yes. Setting m_thing says 'keep it'.
5704 return nextnode;
5705 }
5706 node = node->m_tnext;
5707 }
5708
5709 // Couldn't find an existing node for this sector. Add one at the head
5710 // of the list.
5711
5712 node = P_GetSecnode();
5713
5714 // killough 4/4/98, 4/7/98: mark new nodes unvisited.
5715 node->visited = 0;
5716
5717 node->m_sector = s; // sector
5718 node->m_thing = thing; // mobj
5719 node->m_tprev = NULL; // prev node on Thing thread
5720 node->m_tnext = nextnode; // next node on Thing thread
5721 if (nextnode)
5722 nextnode->m_tprev = node; // set back link on Thing
5723
5724 // Add new node at head of sector thread starting at s->touching_thinglist
5725
5726 node->m_sprev = NULL; // prev node on sector thread
5727 node->m_snext = s->touching_thinglist; // next node on sector thread
5728 if (s->touching_thinglist)
5729 node->m_snext->m_sprev = node;
5730 s->touching_thinglist = node;
5731 return node;
5732}
5733
5734//=============================================================================
5735//

Callers 2

P_UnPredictPlayerFunction · 0.85
P_CreateSecNodeListFunction · 0.85

Calls 2

P_GetSecnodeFunction · 0.85
GetCharsMethod · 0.45

Tested by

no test coverage detected