From e96f9c783f852d4557035d78413798cc0e7f7b21 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Thu, 26 Apr 2018 18:40:57 +0200 Subject: Improve the 'lag' message. --- src/game/game.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/game/game.cpp b/src/game/game.cpp index ae2cb0f..883df60 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -516,6 +516,8 @@ void state_t::tick(ntime_t time_) target = (time_ - t0) / TIME_DELTA; while (frames_since_t0 < target) { + ntime_t tmp; + // FIXME: Is this non-deterministic enough? prng.seed(prng.next() ^ time); @@ -540,15 +542,13 @@ void state_t::tick(ntime_t time_) fc_game.tick(); - if (nclock() - time_ > TIME_LIMIT) { - size_t left; - - left = target - frames_since_t0; + tmp = nclock(); + if (tmp - time_ > TIME_LIMIT) { t0 = nclock(); frames_since_t0 = 0; frames_behind++; - interface.print("(Lag: " + std::to_string(left) + ")"); + interface.print("(Lag: " + std::to_string((tmp - time_) / MSEC(1)) + " ms)"); break; } -- cgit