From 3902acb13d776781d975b3ecbe82760d97675416 Mon Sep 17 00:00:00 2001 From: Tyler Trahan Date: Mon, 20 Nov 2023 12:00:34 -0500 Subject: [PATCH] Codechange: Define a TickCounter variable type for TimerGameTick::counter --- src/timer/timer_game_tick.cpp | 2 +- src/timer/timer_game_tick.h | 3 ++- src/vehicle_base.h | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/timer/timer_game_tick.cpp b/src/timer/timer_game_tick.cpp index bc7f042f88..225204b668 100644 --- a/src/timer/timer_game_tick.cpp +++ b/src/timer/timer_game_tick.cpp @@ -16,7 +16,7 @@ #include "../safeguards.h" -uint64_t TimerGameTick::counter = 0; +TimerGameTick::TickCounter TimerGameTick::counter = 0; template<> void IntervalTimer::Elapsed(TimerGameTick::TElapsed delta) diff --git a/src/timer/timer_game_tick.h b/src/timer/timer_game_tick.h index f1a4bf46c6..0151e45be2 100644 --- a/src/timer/timer_game_tick.h +++ b/src/timer/timer_game_tick.h @@ -22,6 +22,7 @@ class TimerGameTick { public: using Ticks = int32_t; ///< The type to store ticks in + using TickCounter = uint64_t; ///< The type that the tick counter is stored in using TPeriod = uint; using TElapsed = uint; @@ -29,7 +30,7 @@ public: uint elapsed; }; - static uint64_t counter; ///< Monotonic counter, in ticks, since start of game. + static TickCounter counter; ///< Monotonic counter, in ticks, since start of game. }; /** diff --git a/src/vehicle_base.h b/src/vehicle_base.h index 74369a856c..cd0ac70aae 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -331,7 +331,7 @@ public: StationID last_station_visited; ///< The last station we stopped at. StationID last_loading_station; ///< Last station the vehicle has stopped at and could possibly leave from with any cargo loaded. - uint64_t last_loading_tick; ///< Last time (based on TimerGameTick counter) the vehicle has stopped at a station and could possibly leave with any cargo loaded. + TimerGameTick::TickCounter last_loading_tick; ///< Last TimerGameTick::counter tick that the vehicle has stopped at a station and could possibly leave with any cargo loaded. CargoID cargo_type; ///< type of cargo this vehicle is carrying byte cargo_subtype; ///< Used for livery refits (NewGRF variations)