add limit for steps to avoid runaway memory consumption by collision handling
authorsapier <Sapier at GMX dot net>
Wed, 16 Jan 2013 23:27:11 +0000 (23:27 +0000)
committersapier <Sapier at GMX dot net>
Wed, 16 Jan 2013 23:27:11 +0000 (23:27 +0000)
src/collision.cpp

index 143b559fa7e427e3e7a3078e9f2ddc82a370da86..eb948e3c36a1f9252bc0621aa4a8df8af136bb90 100644 (file)
@@ -199,6 +199,10 @@ collisionMoveResult collisionMoveSimple(Map *map, IGameDef *gamedef,
        /*
                Calculate new velocity
        */
+       if( dtime > 0.5 ) {
+               infostream<<"collisionMoveSimple: WARNING: maximum step interval exceeded, lost movement details!"<<std::endl;
+               dtime = 0.5;
+       }
        speed_f += accel_f * dtime;
 
     // If there is no speed, there are no collisions