From: havoc Date: Tue, 20 Nov 2007 20:43:35 +0000 (+0000) Subject: changed FogPoint_World/Model code to use unsigned int instead of signed X-Git-Tag: xonotic-v0.1.0preview~2776 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e68f44435279e9556ed5ad7d70b2bdb3cc997a06;p=xonotic%2Fdarkplaces.git changed FogPoint_World/Model code to use unsigned int instead of signed int, this fixes a crash reported by Andreas Dehmel in certain quoth maps, I have no idea how coordinates can be negative though git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7708 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 577e6fb4..29cb7cbd 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -249,13 +249,13 @@ void FOG_clear(void) float FogPoint_World(const vec3_t p) { - int fogmasktableindex = (int)(VectorDistance((p), r_view.origin) * r_refdef.fogmasktabledistmultiplier); + unsigned int fogmasktableindex = (unsigned int)(VectorDistance((p), r_view.origin) * r_refdef.fogmasktabledistmultiplier); return r_refdef.fogmasktable[min(fogmasktableindex, FOGMASKTABLEWIDTH - 1)]; } float FogPoint_Model(const vec3_t p) { - int fogmasktableindex = (int)(VectorDistance((p), rsurface.modelorg) * r_refdef.fogmasktabledistmultiplier); + unsigned int fogmasktableindex = (unsigned int)(VectorDistance((p), rsurface.modelorg) * r_refdef.fogmasktabledistmultiplier); return r_refdef.fogmasktable[min(fogmasktableindex, FOGMASKTABLEWIDTH - 1)]; }