MCPcopy Create free account
hub / github.com/assaultcube/AC / DeleteNode

Method DeleteNode

source/src/bot/bot_util.h:426–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424 }
425
426 void DeleteNode(node_s *pNode)
427 {
428 if (!pNode)
429 return;
430
431 if (pHeadNode == pNode) // first node
432 {
433 if (pHeadNode == pLastNode)
434 pLastNode = pHeadNode->next;
435
436 pHeadNode = pHeadNode->next;
437 pNode->next = NULL;
438 delete pNode;
439 pNode = NULL;
440 iNodeCount--;
441 return;
442 }
443
444 if (pNode == pLastNode) // last node
445 {
446 pNode = pLastNode;
447 pLastNode->next = NULL;
448
449 pNode->next = NULL;
450 delete pNode;
451 pNode = NULL;
452 iNodeCount--;
453 return;
454 }
455
456 // node is somewhere in the middle
457
458 node_s *pPrevNode = GetPrevNode(pNode);
459 if (!pPrevNode)
460 return;
461
462 // unlink pNode
463 pPrevNode->next = pNode->next;
464 pNode->next = NULL;
465 delete pNode;
466 pNode = NULL;
467 iNodeCount--;
468 }
469};
470
471// ==================================================================

Callers 3

ThinkMethod · 0.45
FloodThinkMethod · 0.45
loopvFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected