From ad25768498944ec92cf18ac48afe601ff4fb3f0f Mon Sep 17 00:00:00 2001 From: Kevin Shanahan Date: Sun, 18 Aug 2013 16:11:41 +0930 Subject: [PATCH] qbsp: exit with error if vertices exceed 65535 Unable to represent this in the bsp29 format, so let the user know instead of silently corrupting the bsp. Signed-off-by: Kevin Shanahan --- qbsp/surfaces.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qbsp/surfaces.c b/qbsp/surfaces.c index 9e8db5b6..f16da620 100644 --- a/qbsp/surfaces.c +++ b/qbsp/surfaces.c @@ -488,6 +488,9 @@ MakeFaceEdges(mapentity_t *entity, node_t *headnode) edges->count = edges->index; } + if (map.cTotal[BSPVERTEX] > 65535) + Error("Too many vertices (%d > 65535)", map.cTotal[BSPVERTEX]); + surfedges->data = AllocMem(BSPSURFEDGE, surfedges->count, true); faces->data = AllocMem(BSPFACE, faces->count, true);