diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/game.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index 55877bb..b623e64 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -174,18 +174,21 @@ void Game::on_update() noexcept std::chrono::duration_cast<std::chrono::milliseconds>( time_now - _last_gen_update_time); - if (time_since_last_gen_update.count() > GENERATION_UPDATE_SPEED_MILLIS) + if (time_since_last_gen_update.count() <= GENERATION_UPDATE_SPEED_MILLIS) { - const auto new_current_gen = _generation_tracker->get_current_generation() + 1U; + _last_update_time = time_now; + return; + } - _generation_tracker->set_current_generation(new_current_gen); + const auto new_current_gen = _generation_tracker->get_current_generation() + 1U; - _status_manager->set_section_body( - StatusLineSection::E, - fmt::format("{}", new_current_gen)); + _generation_tracker->set_current_generation(new_current_gen); - _last_gen_update_time = time_now; - } + _status_manager->set_section_body( + StatusLineSection::E, + fmt::format("{}", new_current_gen)); + + _last_gen_update_time = time_now; auto matrix = _scene->get_matrix(); |