]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
limit max_shot_distance to 230000
authorMartin Taibr <taibr.martin@gmail.com>
Sat, 24 Dec 2016 03:11:30 +0000 (04:11 +0100)
committerMartin Taibr <taibr.martin@gmail.com>
Sat, 24 Dec 2016 03:11:30 +0000 (04:11 +0100)
qcsrc/server/teamplay.qc
qcsrc/server/weapons/tracing.qc

index 0480eb07096c14f0351a98f9eeb93306d433324b..2cab9b8ac9f13a645853e1caa1fc91a476168686 100644 (file)
@@ -52,7 +52,11 @@ void InitGameplayMode()
        get_mi_min_max(1);
        world.mins = mi_min;
        world.maxs = mi_max;
-       max_shot_distance = vlen(world.maxs - world.mins);
+       // currently, NetRadiant's limit is 131072 qu for each side
+       // distance from one corner of a 131072qu cube to the opposite corner is approx. 227023 qu
+       // set the distance according to map size but don't go over the limit to avoid issues with float precision
+       // in case somebody makes extremely large maps
+       max_shot_distance = min(230000, vlen(world.maxs - world.mins));
 
        MapInfo_LoadMapSettings(mapname);
        serverflags &= ~SERVERFLAG_TEAMPLAY;
index b85013d9c0c6fc4a7a67fec6fc1049c19b130d57..fd78c9120a7f1ea42e5e8678aed2c64a33be8dc4 100644 (file)
@@ -399,12 +399,9 @@ void fireBullet(entity this, vector start, vector dir, float spread, float max_s
                start = trace_endpos;
                entity hit = trace_ent;
 
+               // traced up to max_shot_distance and didn't hit anything at all
                if (trace_fraction == 1.0)
-               {
-                       // should not happen if max_shot_distance is correctly determined by map size
-                       LOG_WARN("traced up to max_shot_distance and didn't hit anything at all");
                        break;
-               }
 
                // When hitting sky, stop.
                if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)