OpenTTD Source  14.0-beta1
timer_game_tick.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef TIMER_GAME_TICK_H
11 #define TIMER_GAME_TICK_H
12 
13 #include "../gfx_type.h"
14 
15 #include <chrono>
16 
23 public:
24  using Ticks = int32_t;
25  using TickCounter = uint64_t;
26 
27  using TPeriod = uint;
28  using TElapsed = uint;
29  struct TStorage {
30  uint elapsed;
31  };
32 
34 };
35 
39 class Ticks {
40 public:
41  static constexpr TimerGameTick::Ticks INVALID_TICKS = -1;
42 
48  static constexpr TimerGameTick::Ticks DAY_TICKS = 74;
50 
51  static constexpr TimerGameTick::Ticks STATION_RATING_TICKS = 185;
54  static constexpr TimerGameTick::Ticks CARGO_AGING_TICKS = 185;
56  static constexpr TimerGameTick::Ticks TOWN_GROWTH_TICKS = 70;
58 };
59 
60 #endif /* TIMER_GAME_TICK_H */
Ticks::CARGO_AGING_TICKS
static constexpr TimerGameTick::Ticks CARGO_AGING_TICKS
Cycle duration for aging cargo.
Definition: timer_game_tick.h:54
TimerGameTick::counter
static TickCounter counter
Monotonic counter, in ticks, since start of game.
Definition: timer_game_tick.h:33
Ticks
Storage class for Ticks constants.
Definition: timer_game_tick.h:39
TimerGameTick
Timer that represents the game-ticks.
Definition: timer_game_tick.h:22
TimerGameTick::TickCounter
uint64_t TickCounter
The type that the tick counter is stored in.
Definition: timer_game_tick.h:25
Ticks::INDUSTRY_CUT_TREE_TICKS
static constexpr TimerGameTick::Ticks INDUSTRY_CUT_TREE_TICKS
Cycle duration for lumber mill's extra action.
Definition: timer_game_tick.h:57
Ticks::INVALID_TICKS
static constexpr TimerGameTick::Ticks INVALID_TICKS
Representation of an invalid number of ticks.
Definition: timer_game_tick.h:41
TimerGameTick::TStorage
Definition: timer_game_tick.h:29
Ticks::INDUSTRY_PRODUCE_TICKS
static constexpr TimerGameTick::Ticks INDUSTRY_PRODUCE_TICKS
Cycle duration for industry production.
Definition: timer_game_tick.h:55
Ticks::STATION_LINKGRAPH_TICKS
static constexpr TimerGameTick::Ticks STATION_LINKGRAPH_TICKS
Cycle duration for cleaning dead links.
Definition: timer_game_tick.h:53
Ticks::TOWN_GROWTH_TICKS
static constexpr TimerGameTick::Ticks TOWN_GROWTH_TICKS
Cycle duration for towns trying to grow (this originates from the size of the town array in TTD).
Definition: timer_game_tick.h:56
TimerGameTick::Ticks
int32_t Ticks
The type to store ticks in.
Definition: timer_game_tick.h:24
Ticks::TICKS_PER_SECOND
static constexpr TimerGameTick::Ticks TICKS_PER_SECOND
Estimation of how many ticks fit in a single second.
Definition: timer_game_tick.h:49
MILLISECONDS_PER_TICK
static const uint MILLISECONDS_PER_TICK
The number of milliseconds per game tick.
Definition: gfx_type.h:320
Ticks::STATION_RATING_TICKS
static constexpr TimerGameTick::Ticks STATION_RATING_TICKS
Cycle duration for updating station rating.
Definition: timer_game_tick.h:51
Ticks::DAY_TICKS
static constexpr TimerGameTick::Ticks DAY_TICKS
1 day is 74 ticks; TimerGameCalendar::date_fract used to be uint16_t and incremented by 885.
Definition: timer_game_tick.h:48
Ticks::STATION_ACCEPTANCE_TICKS
static constexpr TimerGameTick::Ticks STATION_ACCEPTANCE_TICKS
Cycle duration for updating station acceptance.
Definition: timer_game_tick.h:52