From 212d591c31f4200b06d38e98b23c5c2bccde1772 Mon Sep 17 00:00:00 2001 From: Hop311 Date: Mon, 22 May 2023 10:26:37 +0100 Subject: Formatting / style cleanup --- src/openvic/GameAdvancementHook.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/openvic/GameAdvancementHook.cpp') diff --git a/src/openvic/GameAdvancementHook.cpp b/src/openvic/GameAdvancementHook.cpp index 0fcdd03..ac16158 100644 --- a/src/openvic/GameAdvancementHook.cpp +++ b/src/openvic/GameAdvancementHook.cpp @@ -3,15 +3,19 @@ using namespace OpenVic; const std::vector GameAdvancementHook::GAME_SPEEDS = { - std::chrono::milliseconds{ 4000 }, - std::chrono::milliseconds{ 3000 }, - std::chrono::milliseconds{ 2000 }, - std::chrono::milliseconds{ 1000 }, - std::chrono::milliseconds{ 100 }, - std::chrono::milliseconds{ 1 } }; + std::chrono::milliseconds { 4000 }, + std::chrono::milliseconds { 3000 }, + std::chrono::milliseconds { 2000 }, + std::chrono::milliseconds { 1000 }, + std::chrono::milliseconds { 100 }, + std::chrono::milliseconds { 1 } +}; -GameAdvancementHook::GameAdvancementHook(AdvancementFunction tickFunction, RefreshFunction updateFunction, bool startPaused, speed_t startingSpeed) - : triggerFunction{ tickFunction }, refreshFunction{ updateFunction }, isPaused{ startPaused } { +GameAdvancementHook::GameAdvancementHook(AdvancementFunction tickFunction, + RefreshFunction updateFunction, bool startPaused, speed_t startingSpeed) + : triggerFunction { tickFunction }, + refreshFunction { updateFunction }, + isPaused { startPaused } { lastPolledTime = std::chrono::high_resolution_clock::now(); setSimulationSpeed(startingSpeed); } @@ -57,7 +61,7 @@ GameAdvancementHook& GameAdvancementHook::operator--() { void GameAdvancementHook::conditionallyAdvanceGame() { if (!isPaused) { - std::chrono::time_point currentTime = std::chrono::high_resolution_clock::now(); + time_point_t currentTime = std::chrono::high_resolution_clock::now(); if (std::chrono::duration_cast(currentTime - lastPolledTime) >= GAME_SPEEDS[currentSpeed]) { lastPolledTime = currentTime; if (triggerFunction) triggerFunction(); -- cgit v1.2.3-56-ga3b1