From 472f73116c620557e70989d1bfa0f052c345b95d Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 23 Mar 2009 14:20:23 +0000 Subject: [PATCH] avoid crashing q3map2 if a surface is >99999 git-svn-id: svn://svn.icculus.org/netradiant/trunk@227 61c419a2-8eb2-4b30-bcec-8cead039b335 --- libs/mathlib/mathlib.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/mathlib/mathlib.c b/libs/mathlib/mathlib.c index 2a93084c..c549cb10 100644 --- a/libs/mathlib/mathlib.c +++ b/libs/mathlib/mathlib.c @@ -269,17 +269,25 @@ void _Vector53Copy (vec5_t in, vec3_t out) } // NOTE: added these from Ritual's Q3Radiant +#define INVALID_BOUNDS 99999 void ClearBounds (vec3_t mins, vec3_t maxs) { - mins[0] = mins[1] = mins[2] = 99999; - maxs[0] = maxs[1] = maxs[2] = -99999; + mins[0] = mins[1] = mins[2] = +INVALID_BOUNDS; + maxs[0] = maxs[1] = maxs[2] = -INVALID_BOUNDS; } void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs) { int i; vec_t val; - + + if(mins[0] == +INVALID_BOUNDS) + if(maxs[0] == -INVALID_BOUNDS) + { + VectorCopy(v, mins); + VectorCopy(v, maxs); + } + for (i=0 ; i<3 ; i++) { val = v[i]; -- 2.39.2