77 if (trigger == this->period.trigger) {
85 if (this->fired)
return;
87 if (trigger == this->period.trigger) {
96 if (_game_mode == GM_MENU)
return false;
99 if (
_settings_game.economy.minutes_per_calendar_year == CalendarTime::FROZEN_MINUTES_PER_YEAR)
return false;
102 if (
_settings_game.economy.minutes_per_calendar_year != CalendarTime::DEF_MINUTES_PER_YEAR) {
137 for (
auto timer : timers) {
138 timer->Elapsed(TimerGameCalendar::Trigger::Day);
142 for (
auto timer : timers) {
143 timer->Elapsed(TimerGameCalendar::Trigger::Month);
148 for (
auto timer : timers) {
149 timer->Elapsed(TimerGameCalendar::Trigger::Year);
167 if (period.priority == TimerGameCalendar::Priority::None)
return;
173 if (timer->period.trigger != period.trigger)
continue;
175 assert(timer->period.priority != period.priority);
void Elapsed(TElapsed count) override
Called by the timer manager to notify the timer that the given amount of time has elapsed.
static constexpr TimerGameTick::Ticks DAY_TICKS
1 day is 74 ticks; TimerGameCalendar::date_fract used to be uint16_t and incremented by 885.
void Elapsed(TElapsed count) override
Called by the timer manager to notify the timer that the given amount of time has elapsed.
static uint16_t sub_date_fract
Subpart of date_fract that we use when calendar days are slower than economy days.
static Month month
Current month (0..11).
static Date ConvertYMDToDate(Year year, Month month, Day day)
Converts a tuple of Year, Month and Day to a Date.
static YearMonthDay ConvertDateToYMD(Date date)
Converts a Date to a Year, Month & Day.
static void SetDate(Date date, DateFract fract)
Set the date.
static Date date
Current date in days (day counter).
static Year year
Current year, starting at 0.
static DateFract date_fract
Fractional part of the day.
static constexpr int DAYS_IN_YEAR
static constexpr TimerGame< struct Calendar >::Year MAX_YEAR
static constexpr int DAYS_IN_LEAP_YEAR
static YearMonthDay CalendarConvertDateToYMD(Date date)
static Date CalendarConvertYMDToDate(Year year, Month month, Day day)
static constexpr bool IsLeapYear(Year year)
The TimerManager manages a single Timer-type.
static std::set< BaseTimer< TTimerType > *, base_timer_sorter > & GetTimers()
Singleton list, to store all the active timers.
static bool Elapsed(TElapsed value)
Called when time for this timer elapsed.
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition of base types and functions in a cross-platform compatible way.
Definition of Interval and OneShot timers.
Definition of the game-calendar-timer.
Base class for all vehicles.