diff options
author | hop311 <hop3114@gmail.com> | 2023-10-28 11:39:08 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-10-29 20:42:47 +0100 |
commit | 164264b047921dbe1567d2af183e1cffb200a8cb (patch) | |
tree | 21c3c81f65ac3259db4808ebe9fd32a94ca993af /src/openvic-simulation/GameAdvancementHook.cpp | |
parent | d8ec90f07342876e9331819bd3cc372050f78248 (diff) |
Astyle formatting (with manual cleanup)
Diffstat (limited to 'src/openvic-simulation/GameAdvancementHook.cpp')
-rw-r--r-- | src/openvic-simulation/GameAdvancementHook.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/openvic-simulation/GameAdvancementHook.cpp b/src/openvic-simulation/GameAdvancementHook.cpp index ac16158..d48a1c2 100644 --- a/src/openvic-simulation/GameAdvancementHook.cpp +++ b/src/openvic-simulation/GameAdvancementHook.cpp @@ -21,12 +21,13 @@ GameAdvancementHook::GameAdvancementHook(AdvancementFunction tickFunction, } void GameAdvancementHook::setSimulationSpeed(speed_t speed) { - if (speed < 0) + if (speed < 0) { currentSpeed = 0; - else if (speed >= GAME_SPEEDS.size()) + } else if (speed >= GAME_SPEEDS.size()) { currentSpeed = GAME_SPEEDS.size() - 1; - else + } else { currentSpeed = speed; + } } GameAdvancementHook::speed_t GameAdvancementHook::getSimulationSpeed() const { @@ -64,10 +65,14 @@ void GameAdvancementHook::conditionallyAdvanceGame() { time_point_t currentTime = std::chrono::high_resolution_clock::now(); if (std::chrono::duration_cast<std::chrono::milliseconds>(currentTime - lastPolledTime) >= GAME_SPEEDS[currentSpeed]) { lastPolledTime = currentTime; - if (triggerFunction) triggerFunction(); + if (triggerFunction) { + triggerFunction(); + } } } - if (refreshFunction) refreshFunction(); + if (refreshFunction) { + refreshFunction(); + } } void GameAdvancementHook::reset() { |