aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/GameAdvancementHook.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/GameAdvancementHook.cpp')
-rw-r--r--src/openvic-simulation/GameAdvancementHook.cpp15
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() {