aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEsteban I. Ruiz Moreno <exio4.com@gmail.com>2013-04-02 20:24:45 -0300
committerPilzAdam <pilzadam@minetest.net>2013-04-03 23:29:51 +0200
commit6b8435cf8c92b0d6e2988a7c5034148bd74d387b (patch)
tree2112697df24fa03b7a8224e04b68eb7833a2c1b6 /src
parentc1bf6f9f7a6d2c5bd743422593a5ec72939bc6af (diff)
downloadminetest-6b8435cf8c92b0d6e2988a7c5034148bd74d387b.tar.gz
minetest-6b8435cf8c92b0d6e2988a7c5034148bd74d387b.tar.bz2
minetest-6b8435cf8c92b0d6e2988a7c5034148bd74d387b.zip
Limit speed in collisionMoveResult for avoiding hangs
Diffstat (limited to 'src')
-rw-r--r--src/collision.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/collision.cpp b/src/collision.cpp
index 806a3b720..cd170196f 100644
--- a/src/collision.cpp
+++ b/src/collision.cpp
@@ -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
*/