| 93 | } |
| 94 | |
| 95 | void 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 | // |
| 118 | void CGameWorld::Snap(int SnappingClient) |