OpenTTD Source 20241224-master-gf74b0cf984
TimerGameConst< T > Class Template Reference

Template class for time constants shared by both Calendar and Economy time. More...

#include <timer_game_common.h>

Static Public Attributes

static constexpr int DAYS_IN_YEAR = 365
 days per year
 
static constexpr int DAYS_IN_LEAP_YEAR = 366
 sometimes, you need one day more...
 
static constexpr int MONTHS_IN_YEAR = 12
 months per year
 
static constexpr int SECONDS_PER_DAY = 2
 approximate seconds per day, not for precise calculations
 
static constexpr TimerGame< T >::Year ORIGINAL_BASE_YEAR = 1920
 The minimum starting year/base year of the original TTD.
 
static constexpr TimerGame< T >::Year ORIGINAL_END_YEAR = 2051
 The original ending year.
 
static constexpr TimerGame< T >::Year ORIGINAL_MAX_YEAR = 2090
 The maximum year of the original TTD.
 
static constexpr TimerGame< T >::Year MAX_YEAR = 5000000
 MAX_YEAR, nicely rounded value of the number of years that can be encoded in a single 32 bits date, about 2^31 / 366 years.
 
static constexpr TimerGame< T >::Year MIN_YEAR = 0
 The absolute minimum year in OTTD.
 
static constexpr TimerGame< T >::Year DEF_START_YEAR = 1950
 The default starting year.
 
static constexpr TimerGame< T >::Year DEF_END_YEAR = ORIGINAL_END_YEAR - 1
 The default scoring end year.
 
static constexpr TimerGame< T >::Date DAYS_TILL_ORIGINAL_BASE_YEAR = TimerGame<T>::DateAtStartOfYear(ORIGINAL_BASE_YEAR)
 The date of the first day of the original base year.
 
static constexpr TimerGame< T >::Date MAX_DATE = TimerGame<T>::DateAtStartOfYear(MAX_YEAR + 1) - 1
 The date of the last day of the max year.
 
static constexpr TimerGame< T >::Date MIN_DATE = 0
 The date on January 1, year 0.
 
static constexpr TimerGame< T >::Year INVALID_YEAR = -1
 Representation of an invalid year.
 
static constexpr TimerGame< T >::Date INVALID_DATE = -1
 Representation of an invalid date.
 

Detailed Description

template<class T>
class TimerGameConst< T >

Template class for time constants shared by both Calendar and Economy time.

Definition at line 147 of file timer_game_common.h.

Field Documentation

◆ DAYS_IN_LEAP_YEAR

template<class T >
constexpr int TimerGameConst< T >::DAYS_IN_LEAP_YEAR = 366
staticconstexpr

sometimes, you need one day more...

Definition at line 150 of file timer_game_common.h.

◆ DAYS_IN_YEAR

template<class T >
constexpr int TimerGameConst< T >::DAYS_IN_YEAR = 365
staticconstexpr

days per year

Definition at line 149 of file timer_game_common.h.

◆ DAYS_TILL_ORIGINAL_BASE_YEAR

template<class T >
constexpr TimerGame<T>::Date TimerGameConst< T >::DAYS_TILL_ORIGINAL_BASE_YEAR = TimerGame<T>::DateAtStartOfYear(ORIGINAL_BASE_YEAR)
staticconstexpr

The date of the first day of the original base year.

Definition at line 184 of file timer_game_common.h.

◆ DEF_END_YEAR

template<class T >
constexpr TimerGame<T>::Year TimerGameConst< T >::DEF_END_YEAR = ORIGINAL_END_YEAR - 1
staticconstexpr

The default scoring end year.

Definition at line 181 of file timer_game_common.h.

◆ DEF_START_YEAR

template<class T >
constexpr TimerGame<T>::Year TimerGameConst< T >::DEF_START_YEAR = 1950
staticconstexpr

The default starting year.

Definition at line 179 of file timer_game_common.h.

◆ INVALID_DATE

template<class T >
constexpr TimerGame<T>::Date TimerGameConst< T >::INVALID_DATE = -1
staticconstexpr

Representation of an invalid date.

Definition at line 193 of file timer_game_common.h.

◆ INVALID_YEAR

template<class T >
constexpr TimerGame<T>::Year TimerGameConst< T >::INVALID_YEAR = -1
staticconstexpr

Representation of an invalid year.

Definition at line 192 of file timer_game_common.h.

◆ MAX_DATE

template<class T >
constexpr TimerGame<T>::Date TimerGameConst< T >::MAX_DATE = TimerGame<T>::DateAtStartOfYear(MAX_YEAR + 1) - 1
staticconstexpr

The date of the last day of the max year.

Definition at line 187 of file timer_game_common.h.

◆ MAX_YEAR

template<class T >
constexpr TimerGame<T>::Year TimerGameConst< T >::MAX_YEAR = 5000000
staticconstexpr

MAX_YEAR, nicely rounded value of the number of years that can be encoded in a single 32 bits date, about 2^31 / 366 years.

Definition at line 173 of file timer_game_common.h.

◆ MIN_DATE

template<class T >
constexpr TimerGame<T>::Date TimerGameConst< T >::MIN_DATE = 0
staticconstexpr

The date on January 1, year 0.

Definition at line 190 of file timer_game_common.h.

◆ MIN_YEAR

template<class T >
constexpr TimerGame<T>::Year TimerGameConst< T >::MIN_YEAR = 0
staticconstexpr

The absolute minimum year in OTTD.

Definition at line 176 of file timer_game_common.h.

◆ MONTHS_IN_YEAR

template<class T >
constexpr int TimerGameConst< T >::MONTHS_IN_YEAR = 12
staticconstexpr

months per year

Definition at line 151 of file timer_game_common.h.

◆ ORIGINAL_BASE_YEAR

template<class T >
constexpr TimerGame<T>::Year TimerGameConst< T >::ORIGINAL_BASE_YEAR = 1920
staticconstexpr

The minimum starting year/base year of the original TTD.

Definition at line 163 of file timer_game_common.h.

◆ ORIGINAL_END_YEAR

template<class T >
constexpr TimerGame<T>::Year TimerGameConst< T >::ORIGINAL_END_YEAR = 2051
staticconstexpr

The original ending year.

Definition at line 165 of file timer_game_common.h.

◆ ORIGINAL_MAX_YEAR

template<class T >
constexpr TimerGame<T>::Year TimerGameConst< T >::ORIGINAL_MAX_YEAR = 2090
staticconstexpr

The maximum year of the original TTD.

Definition at line 167 of file timer_game_common.h.

◆ SECONDS_PER_DAY

template<class T >
constexpr int TimerGameConst< T >::SECONDS_PER_DAY = 2
staticconstexpr

approximate seconds per day, not for precise calculations

Definition at line 153 of file timer_game_common.h.


The documentation for this class was generated from the following file: