qbsp: tidy FreeBrushes

This commit is contained in:
Eric Wasylishen 2017-07-23 02:48:58 -06:00
parent 2ee9017879
commit 7c49d499c2
3 changed files with 8 additions and 6 deletions

View File

@ -42,7 +42,7 @@ int Brush_ListCount(const brush_t *brush);
int Brush_NumFaces(const brush_t *brush);
brush_t *LoadBrush(const mapbrush_t *mapbrush, const vec3_t rotate_offset, const int hullnum);
void FreeBrushes(brush_t *brushlist);
void FreeBrushes(mapentity_t *ent);
int FindPlane(const vec3_t normal, const vec_t dist, int *side);
bool PlaneEqual(const qbsp_plane_t *p1, const qbsp_plane_t *p2);

View File

@ -508,15 +508,16 @@ FreeBrushes
=====================
*/
void
FreeBrushes(brush_t *brushlist)
FreeBrushes(mapentity_t *ent)
{
brush_t *brush, *next;
for (brush = brushlist; brush; brush = next) {
for (brush = ent->brushes; brush; brush = next) {
next = brush->next;
FreeBrushFaces(brush->faces);
FreeMem(brush, BRUSH, 1);
}
ent->brushes = nullptr;
}
/*

View File

@ -153,8 +153,7 @@ ProcessEntity(mapentity_t *entity, const int hullnum)
* leaving a perfect skin of the model with no hidden faces
*/
surfs = CSGFaces(entity);
FreeBrushes(entity->brushes);
if (options.fObjExport && entity == pWorldEnt() && hullnum == 0) {
ExportObj(surfs);
}
@ -232,6 +231,8 @@ ProcessEntity(mapentity_t *entity, const int hullnum)
ExportDrawNodes(entity, nodes, firstface);
}
FreeBrushes(entity);
map.cTotal[LUMP_MODELS]++;
}
@ -503,7 +504,7 @@ static void BSPX_CreateBrushList(void)
}
BSPX_Brushes_AddModel(&ctx, modelnum , ent->brushes);
FreeBrushes(ent->brushes);
FreeBrushes(ent);
}
BSPX_Brushes_Finalize(&ctx);