MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / DestroyBSPNode

Function DestroyBSPNode

Descent3/bsp.cpp:742–760  ·  view source on GitHub ↗

Releases memory for a bspnode. This function calls itself recursively

Source from the content-addressed store, hash-verified

740
741// Releases memory for a bspnode. This function calls itself recursively
742void DestroyBSPNode(bspnode *node) {
743 if (node->type == BSP_NODE) {
744 if (node->front)
745 DestroyBSPNode(node->front);
746 if (node->back)
747 DestroyBSPNode(node->back);
748 }
749
750 int np = CountListItems(&node->polylist);
751
752 for (int i = 0; i < np; i++) {
753 bsppolygon *poly = (bsppolygon *)GetListItem(&node->polylist, i);
754 FreePolygon(poly);
755 }
756 if (np > 0)
757 DestroyList(&node->polylist);
758
759 mem_free(node);
760}
761
762// Walks the BSP tree and frees up any nodes/polygons that we might be using
763void DestroyBSPTree(bsptree *tree) {

Callers 1

DestroyBSPTreeFunction · 0.85

Calls 4

CountListItemsFunction · 0.85
GetListItemFunction · 0.85
FreePolygonFunction · 0.85
DestroyListFunction · 0.85

Tested by

no test coverage detected