fixed clamping of insane moves

This commit is contained in:
Magnus Auvinen 2007-12-16 13:32:59 +00:00
parent 6285917917
commit fdc4889768
2 changed files with 15 additions and 2 deletions

View file

@ -784,6 +784,12 @@ extern "C" void modc_predict()
if(!world.players[c])
continue;
// TODO: this should be moved into the g_game
// but not done to preserve the nethash
if(length(world.players[c]->vel) > 150.0f)
world.players[c]->vel = normalize(world.players[c]->vel) * 150.0f;
world.players[c]->move();
world.players[c]->quantize();
}

View file

@ -1069,8 +1069,15 @@ void player::tick_defered()
vec2 start_pos = core.pos;
vec2 start_vel = core.vel;
bool stuck_before = test_box(core.pos, vec2(28.0f, 28.0f));
if(length(core.vel) > 100.0f)
dbg_msg("server", "insane move! (%f,%f) %f", core.vel.x, core.vel.y, length(core.vel));
// TODO: this should be moved into the g_game
// but not done to preserve the nethash
if(length(core.vel) > 150.0f)
{
dbg_msg("server", "insane move! clamping (%f,%f) %f", core.vel.x, core.vel.y, length(core.vel));
core.vel = normalize(core.vel) * 150.0f;
}
core.move();
bool stuck_after_move = test_box(core.pos, vec2(28.0f, 28.0f));
core.quantize();