Codechange: migrate all game-time-related timers to the new framework

This commit is contained in:
Patric Stout
2023-04-13 13:56:00 +02:00
committed by Patric Stout
parent 1ba4dcc924
commit 3ebc7ad16e
25 changed files with 166 additions and 145 deletions

View File

@@ -22,6 +22,9 @@
#include "hotkeys.h"
#include "zoom_func.h"
#include "misc_cmd.h"
#include "timer/timer.h"
#include "timer/timer_game_calendar.h"
#include "date_func.h"
#include "widgets/highscore_widget.h"
@@ -250,3 +253,14 @@ void ShowEndGameChart()
CloseWindowByClass(WC_ENDSCREEN);
new EndGameWindow(&_endgame_desc);
}
static IntervalTimer<TimerGameCalendar> _check_end_game({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)
{
/* 0 = never */
if (_settings_game.game_creation.ending_year == 0) return;
/* Show the end-game chart at the end of the ending year (hence the + 1). */
if (_cur_year == _settings_game.game_creation.ending_year + 1) {
ShowEndGameChart();
}
});