diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2018-04-26 18:40:57 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2018-04-26 18:46:04 +0200 |
commit | e96f9c783f852d4557035d78413798cc0e7f7b21 (patch) | |
tree | 2ea6a875179021282787b7b82761c8853795b668 /src/game | |
parent | f71cb8a968ba5b284d960d89642c1c62fc9d6f4f (diff) |
Improve the 'lag' message.
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/game.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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; } |