From c6879a90279ecda975328e84e1aed67b56be5018 Mon Sep 17 00:00:00 2001 From: cholleme <> Date: Sun, 2 Mar 2003 20:28:06 +0000 Subject: [PATCH] Fixed small problem with the neighbour setup Fixed crash when there were very few surfaces in the map --- gl_q3bsp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gl_q3bsp.c b/gl_q3bsp.c index 4a8141b..410d113 100644 --- a/gl_q3bsp.c +++ b/gl_q3bsp.c @@ -269,7 +269,7 @@ void findNeighbourForEdge(glpoly_t *poly, int neighindex) { eindex = poly->neighbours[neighindex].p1; eindex2 = poly->neighbours[neighindex].p2; - if (poly->neighbours[eindex].n != NULL) return; + if (poly->neighbours[neighindex].n != NULL) return; for (i=0; inumsurfaces; i++) { p = loadmodel->surfaces[i].polys; @@ -283,8 +283,7 @@ void findNeighbourForEdge(glpoly_t *poly, int neighindex) { np2 = p->neighbours[j].p2; if ((vertexEqual(&tempVertices[np1],&tempVertices[eindex]) - && vertexEqual(&tempVertices[np2],&tempVertices[eindex2]) - ) + && vertexEqual(&tempVertices[np2],&tempVertices[eindex2])) || (vertexEqual(&tempVertices[np2],&tempVertices[eindex]) && vertexEqual(&tempVertices[np1],&tempVertices[eindex2]))) @@ -673,6 +672,8 @@ void ModQ3_SetupFaces (void) char cache[MAX_QPATH], fullpath[MAX_OSPATH]; int mod = loadmodel->numsurfaces / 10; int progress = 0; + + if (mod < 1) mod = 1; numnaughty = 0; numnormal = 0; noneighbour = 0;