qbsp: move FreeTreePortals to tree.cc

This commit is contained in:
Eric Wasylishen 2022-07-04 00:26:28 -06:00
parent fce258a7b7
commit ac80d11e69
4 changed files with 25 additions and 25 deletions

View File

@ -54,7 +54,6 @@ bool Portal_EntityFlood(const portal_t *p, int32_t s);
void MakeNodePortal(tree_t *tree, node_t *node, portalstats_t &stats);
void SplitNodePortals(tree_t *tree, node_t *node, portalstats_t &stats);
void MakeTreePortals(tree_t *tree);
void FreeTreePortals(tree_t *tree);
void AssertNoPortals(tree_t *tree);
void MakeHeadnodePortals(tree_t *tree);
void EmitAreaPortals(node_t *headnode);

View File

@ -46,5 +46,6 @@ struct tree_t
portal_t *create_portal();
};
void FreeTreePortals(tree_t *tree);
void DetailToSolid(node_t *node);
void PruneNodes(node_t *node);

View File

@ -478,30 +478,6 @@ void AssertNoPortals(tree_t *tree)
Q_assert(tree->portals.empty());
}
/*
==================
FreeTreePortals_r
==================
*/
static void ClearNodePortals_r(node_t *node)
{
if (node->planenum != PLANENUM_LEAF) {
ClearNodePortals_r(node->children[0].get());
ClearNodePortals_r(node->children[1].get());
}
node->portals = nullptr;
}
void FreeTreePortals(tree_t *tree)
{
ClearNodePortals_r(tree->headnode.get());
tree->outside_node.portals = nullptr;
tree->portals.clear();
}
/*
=========================================================

View File

@ -37,6 +37,30 @@ portal_t *tree_t::create_portal()
return result;
}
/*
==================
FreeTreePortals_r
==================
*/
static void ClearNodePortals_r(node_t *node)
{
if (node->planenum != PLANENUM_LEAF) {
ClearNodePortals_r(node->children[0].get());
ClearNodePortals_r(node->children[1].get());
}
node->portals = nullptr;
}
void FreeTreePortals(tree_t *tree)
{
ClearNodePortals_r(tree->headnode.get());
tree->outside_node.portals = nullptr;
tree->portals.clear();
}
//============================================================================
static void ConvertNodeToLeaf(node_t *node, const contentflags_t &contents)