Limit speed in collisionMoveResult for avoiding hangs
authorEsteban I. Ruiz Moreno <exio4.com@gmail.com>
Tue, 2 Apr 2013 23:24:45 +0000 (20:24 -0300)
committerPilzAdam <pilzadam@minetest.net>
Wed, 3 Apr 2013 21:29:51 +0000 (23:29 +0200)
src/collision.cpp

index 806a3b7203278cdd43a821c869e8a5848672e622..cd170196f4ef17e5b10666b0b3cbe9af79c28a6f 100644 (file)
@@ -209,10 +209,15 @@ collisionMoveResult collisionMoveSimple(Environment *env, IGameDef *gamedef,
        }
        speed_f += accel_f * dtime;
 
-    // If there is no speed, there are no collisions
+       // If there is no speed, there are no collisions
        if(speed_f.getLength() == 0)
                return result;
 
+       // Limit speed for avoiding hangs
+       speed_f.Y=rangelim(speed_f.Y,-5000,5000);
+       speed_f.X=rangelim(speed_f.X,-5000,5000);
+       speed_f.Z=rangelim(speed_f.Z,-5000,5000);
+
        /*
                Collect node boxes in movement range
        */