Codechange: Pass WindowDesc by reference instead of pointer. (#12771)

WindowDesc as passed to Windows is not optional so don't allow to it to be nullptr.
This commit is contained in:
Peter Nelson
2024-06-11 08:58:03 +01:00
committed by GitHub
parent 18bce69623
commit 4cf6d1dd79
68 changed files with 293 additions and 301 deletions

View File

@@ -33,7 +33,7 @@ struct EndGameHighScoreBaseWindow : Window {
uint32_t background_img;
int8_t rank;
EndGameHighScoreBaseWindow(WindowDesc *desc) : Window(desc)
EndGameHighScoreBaseWindow(WindowDesc &desc) : Window(desc)
{
this->InitNested();
CLRBITS(this->flags, WF_WHITE_BORDER);
@@ -96,7 +96,7 @@ struct EndGameHighScoreBaseWindow : Window {
/** End game window shown at the end of the game */
struct EndGameWindow : EndGameHighScoreBaseWindow {
EndGameWindow(WindowDesc *desc) : EndGameHighScoreBaseWindow(desc)
EndGameWindow(WindowDesc &desc) : EndGameHighScoreBaseWindow(desc)
{
/* Pause in single-player to have a look at the highscore at your own leisure */
if (!_networking) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
@@ -158,7 +158,7 @@ struct EndGameWindow : EndGameHighScoreBaseWindow {
struct HighScoreWindow : EndGameHighScoreBaseWindow {
bool game_paused_by_player; ///< True if the game was paused by the player when the highscore window was opened.
HighScoreWindow(WindowDesc *desc, int difficulty, int8_t ranking) : EndGameHighScoreBaseWindow(desc)
HighScoreWindow(WindowDesc &desc, int difficulty, int8_t ranking) : EndGameHighScoreBaseWindow(desc)
{
/* pause game to show the chart */
this->game_paused_by_player = _pause_mode == PM_PAUSED_NORMAL;
@@ -236,7 +236,7 @@ static WindowDesc _endgame_desc(
void ShowHighscoreTable(int difficulty, int8_t ranking)
{
CloseWindowByClass(WC_HIGHSCORE);
new HighScoreWindow(&_highscore_desc, difficulty, ranking);
new HighScoreWindow(_highscore_desc, difficulty, ranking);
}
/**
@@ -250,7 +250,7 @@ void ShowEndGameChart()
HideVitalWindows();
CloseWindowByClass(WC_ENDSCREEN);
new EndGameWindow(&_endgame_desc);
new EndGameWindow(_endgame_desc);
}
static IntervalTimer<TimerGameCalendar> _check_end_game({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto)