MCPcopy Create free account
hub / github.com/ddnet/ddnet / RemoveEntity

Method RemoveEntity

src/game/server/gameworld.cpp:95–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95void CGameWorld::RemoveEntity(CEntity *pEnt)
96{
97 // not in the list
98 if(!pEnt->m_pNextTypeEntity && !pEnt->m_pPrevTypeEntity && m_apFirstEntityTypes[pEnt->m_ObjType] != pEnt)
99 return;
100
101 // remove
102 if(pEnt->m_pPrevTypeEntity)
103 pEnt->m_pPrevTypeEntity->m_pNextTypeEntity = pEnt->m_pNextTypeEntity;
104 else
105 m_apFirstEntityTypes[pEnt->m_ObjType] = pEnt->m_pNextTypeEntity;
106 if(pEnt->m_pNextTypeEntity)
107 pEnt->m_pNextTypeEntity->m_pPrevTypeEntity = pEnt->m_pPrevTypeEntity;
108
109 // keep list traversing valid
110 if(m_pNextTraverseEntity == pEnt)
111 m_pNextTraverseEntity = pEnt->m_pNextTypeEntity;
112
113 pEnt->m_pNextTypeEntity = nullptr;
114 pEnt->m_pPrevTypeEntity = nullptr;
115}
116
117//
118void CGameWorld::Snap(int SnappingClient)

Callers 3

~CEntityMethod · 0.45
DieMethod · 0.45
PauseMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected