Codechange: use constructor instead of assignment for date/year constants

This commit is contained in:
Rubidium 2024-12-31 23:18:54 +01:00 committed by rubidium42
parent 41f7d54b4f
commit 58ba8c122b
6 changed files with 20 additions and 20 deletions

View File

@ -14,9 +14,9 @@
#include "settings_type.h"
#include "strings_type.h"
static constexpr TimerGameCalendar::Year CF_NOEURO = 0; ///< Currency never switches to the Euro (as far as known).
static constexpr TimerGameCalendar::Year CF_ISEURO = 1; ///< Currency _is_ the Euro.
static constexpr TimerGameCalendar::Year MIN_EURO_YEAR = 2000; ///< The earliest year custom currencies may switch to the Euro.
static constexpr TimerGameCalendar::Year CF_NOEURO{0}; ///< Currency never switches to the Euro (as far as known).
static constexpr TimerGameCalendar::Year CF_ISEURO{1}; ///< Currency _is_ the Euro.
static constexpr TimerGameCalendar::Year MIN_EURO_YEAR{2000}; ///< The earliest year custom currencies may switch to the Euro.
/**
* This enum gives the currencies a unique id which must be maintained for

View File

@ -23,7 +23,7 @@
typedef Pool<Industry, IndustryID, 64, 64000> IndustryPool;
extern IndustryPool _industry_pool;
static const TimerGameEconomy::Year PROCESSING_INDUSTRY_ABANDONMENT_YEARS = 5; ///< If a processing industry doesn't produce for this many consecutive economy years, it may close.
static const TimerGameEconomy::Year PROCESSING_INDUSTRY_ABANDONMENT_YEARS{5}; ///< If a processing industry doesn't produce for this many consecutive economy years, it may close.
/*
* Production level maximum, minimum and default values.

View File

@ -170,10 +170,10 @@ public:
static const uint MIN_TIMEOUT_DISTANCE = 32;
/** Number of days before deleting links served only by vehicles stopped in depot. */
static constexpr TimerGameEconomy::Date STALE_LINK_DEPOT_TIMEOUT = 1024;
static constexpr TimerGameEconomy::Date STALE_LINK_DEPOT_TIMEOUT{1024};
/** Minimum number of days between subsequent compressions of a LG. */
static constexpr TimerGameEconomy::Date COMPRESSION_INTERVAL = 256;
static constexpr TimerGameEconomy::Date COMPRESSION_INTERVAL{256};
/**
* Scale a value from a link graph of age orig_age for usage in one of age

View File

@ -160,37 +160,37 @@ public:
*/
/** The minimum starting year/base year of the original TTD */
static constexpr typename TimerGame<T>::Year ORIGINAL_BASE_YEAR = 1920;
static constexpr typename TimerGame<T>::Year ORIGINAL_BASE_YEAR{1920};
/** The original ending year */
static constexpr typename TimerGame<T>::Year ORIGINAL_END_YEAR = 2051;
static constexpr typename TimerGame<T>::Year ORIGINAL_END_YEAR{2051};
/** The maximum year of the original TTD */
static constexpr typename TimerGame<T>::Year ORIGINAL_MAX_YEAR = 2090;
static constexpr typename TimerGame<T>::Year ORIGINAL_MAX_YEAR{2090};
/**
* 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 typename TimerGame<T>::Year MAX_YEAR = 5000000;
static constexpr typename TimerGame<T>::Year MAX_YEAR{5000000};
/** The absolute minimum year in OTTD */
static constexpr typename TimerGame<T>::Year MIN_YEAR = 0;
static constexpr typename TimerGame<T>::Year MIN_YEAR{0};
/** The default starting year */
static constexpr typename TimerGame<T>::Year DEF_START_YEAR = 1950;
static constexpr typename TimerGame<T>::Year DEF_START_YEAR{1950};
/** The default scoring end year */
static constexpr typename TimerGame<T>::Year DEF_END_YEAR = ORIGINAL_END_YEAR - 1;
static constexpr typename TimerGame<T>::Year DEF_END_YEAR{ORIGINAL_END_YEAR - 1};
/** The date of the first day of the original base year. */
static constexpr typename TimerGame<T>::Date DAYS_TILL_ORIGINAL_BASE_YEAR = TimerGame<T>::DateAtStartOfYear(ORIGINAL_BASE_YEAR);
static constexpr typename TimerGame<T>::Date DAYS_TILL_ORIGINAL_BASE_YEAR{TimerGame<T>::DateAtStartOfYear(ORIGINAL_BASE_YEAR)};
/** The date of the last day of the max year. */
static constexpr typename TimerGame<T>::Date MAX_DATE = TimerGame<T>::DateAtStartOfYear(MAX_YEAR + 1) - 1;
static constexpr typename TimerGame<T>::Date MAX_DATE{TimerGame<T>::DateAtStartOfYear(MAX_YEAR + 1) - 1};
/** The date on January 1, year 0. */
static constexpr typename TimerGame<T>::Date MIN_DATE = 0;
static constexpr typename TimerGame<T>::Date MIN_DATE{0};
static constexpr typename TimerGame<T>::Year INVALID_YEAR = -1; ///< Representation of an invalid year
static constexpr typename TimerGame<T>::Date INVALID_DATE = -1; ///< Representation of an invalid date
static constexpr typename TimerGame<T>::Year INVALID_YEAR{-1}; ///< Representation of an invalid year
static constexpr typename TimerGame<T>::Date INVALID_DATE{-1}; ///< Representation of an invalid date
};
#endif /* TIMER_GAME_COMMON_H */

View File

@ -14,7 +14,7 @@
#include "timer/timer_game_economy.h"
#include "vehicle_type.h"
static const TimerGameEconomy::Year MAX_TIMETABLE_START_YEARS = 15; ///< The maximum start date offset, in economy years.
static const TimerGameEconomy::Year MAX_TIMETABLE_START_YEARS{15}; ///< The maximum start date offset, in economy years.
enum class TimetableMode : uint8_t {
Days,

View File

@ -25,7 +25,7 @@
#define IS_CUSTOM_FIRSTHEAD_SPRITE(x) (x == 0xFD)
#define IS_CUSTOM_SECONDHEAD_SPRITE(x) (x == 0xFE)
static const TimerGameEconomy::Date VEHICLE_PROFIT_MIN_AGE = CalendarTime::DAYS_IN_YEAR * 2; ///< Only vehicles older than this have a meaningful profit.
static const TimerGameEconomy::Date VEHICLE_PROFIT_MIN_AGE{CalendarTime::DAYS_IN_YEAR * 2}; ///< Only vehicles older than this have a meaningful profit.
static const Money VEHICLE_PROFIT_THRESHOLD = 10000; ///< Threshold for a vehicle to be considered making good profit.
/**