qbsp: increase unique vertex estimate to cope with skip faces

The old assumption about unique verticies is sometimes untrue when
skip faces are included in the map.  Be more generous with the vertex
memory allocation. This is not an area of peak memory usage anyway, so
shouldn't be a big deal.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2013-04-18 08:21:27 +09:30
parent 828a34a959
commit cd188ebc99
1 changed files with 5 additions and 4 deletions

View File

@ -454,13 +454,14 @@ MakeFaceEdges(mapentity_t *entity, node_t *headnode)
CountData_r(entity, headnode);
/*
* Guess: less than half vertices actually are unique. Add one to round up
* odd values. Remember edges are +1 in BeginBSPFile.
* Remember edges are +1 in BeginBSPFile. Often less than half
* the vertices actually are unique, although heavy use of skip
* faces will break that assumption. 2/3 should be safe most of
* the time without wasting *quite* so much memory...
*/
surfedges->count = vertices->count;
vertices->count++;
vertices->count /= 2;
edges->count += surfedges->count;
vertices->count = vertices->count * 2 / 3;
vertices->data = AllocMem(BSPVERTEX, vertices->count, true);
edges->data = AllocMem(BSPEDGE, edges->count, true);