X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fclient%2Fclient.cpp;h=d20a98c32bcdcd514d44fb7ef37c5964416f9fb0;hb=8e9e2bb4b2dd5a4100f4531628ab58002fe253c1;hp=3c30a62495127a52ace02decb18233c845e463f5;hpb=225a7e66ed3f3f03ab458ab39c914ed55cd69600;p=blank.git diff --git a/src/client/client.cpp b/src/client/client.cpp index 3c30a62..d20a98c 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -62,7 +62,9 @@ InteractiveState::InteractiveState(MasterState &master, uint32_t player_id) , stat_timer(1000) , sky(master.GetEnv().loader.LoadCubeMap("skybox")) , update_status() -, chat(master.GetEnv(), *this, *this) { +, chat(master.GetEnv(), *this, *this) +, time_skipped(0) +, packets_skipped(0) { if (!save.Exists()) { save.Write(master.GetWorldConf()); } @@ -163,11 +165,18 @@ void InteractiveState::Update(int dt) { hud.FocusNone(); } if (world_dt > 0) { - input.PushPlayerUpdate(world_dt); + if (input.UpdateImportant() || packets_skipped >= master.NetStat().SuggestedPacketSkip()) { + input.PushPlayerUpdate(time_skipped + world_dt); + time_skipped = 0; + packets_skipped = 0; + } else { + time_skipped += world_dt; + ++packets_skipped; + } } hud.Display(res.block_types[player.GetInventorySlot() + 1]); if (stat_timer.Hit()) { - hud.UpdateNetStats(master); + hud.UpdateNetStats(master.NetStat()); } hud.Update(dt);