OpenTTD Source 20241224-master-gf74b0cf984
highscore_gui.cpp File Reference

Definition of the HighScore and EndGame windows. More...

#include "stdafx.h"
#include "highscore.h"
#include "table/strings.h"
#include "gfx_func.h"
#include "table/sprites.h"
#include "window_gui.h"
#include "window_func.h"
#include "network/network.h"
#include "command_func.h"
#include "company_func.h"
#include "company_base.h"
#include "strings_func.h"
#include "hotkeys.h"
#include "zoom_func.h"
#include "misc_cmd.h"
#include "timer/timer.h"
#include "timer/timer_game_calendar.h"
#include "widgets/highscore_widget.h"
#include "safeguards.h"

Go to the source code of this file.

Data Structures

struct  EndGameHighScoreBaseWindow
 
struct  EndGameWindow
 End game window shown at the end of the game. More...
 
struct  HighScoreWindow
 

Functions

void ShowHighscoreTable (int difficulty, int8_t ranking)
 Show the highscore table for a given difficulty.
 
void ShowEndGameChart ()
 Show the endgame victory screen in 2050.
 

Variables

static constexpr NWidgetPart _nested_highscore_widgets []
 
static WindowDesc _highscore_desc (WDP_MANUAL, nullptr, 0, 0, WC_HIGHSCORE, WC_NONE, 0, _nested_highscore_widgets)
 
static WindowDesc _endgame_desc (WDP_MANUAL, nullptr, 0, 0, WC_ENDSCREEN, WC_NONE, 0, _nested_highscore_widgets)
 
static IntervalTimer< TimerGameCalendar_check_end_game ({TimerGameCalendar::YEAR, TimerGameCalendar::Priority::NONE}, [](auto) { if(_settings_game.game_creation.ending_year==0) return;if(TimerGameCalendar::year==_settings_game.game_creation.ending_year+1) { ShowEndGameChart();} })
 

Detailed Description

Definition of the HighScore and EndGame windows.

Definition in file highscore_gui.cpp.

Function Documentation

◆ ShowEndGameChart()

void ShowEndGameChart ( )

◆ ShowHighscoreTable()

void ShowHighscoreTable ( int  difficulty,
int8_t  ranking 
)

Show the highscore table for a given difficulty.

When called from endgame ranking is set to the top5 element that was newly added and is thus highlighted

Definition at line 236 of file highscore_gui.cpp.

References CloseWindowByClass(), and WC_HIGHSCORE.

Referenced by EndGameWindow::Close(), MenuClickGraphsOrLeague(), and SelectGameWindow::OnClick().

Variable Documentation

◆ _nested_highscore_widgets

constexpr NWidgetPart _nested_highscore_widgets[]
staticconstexpr
Initial value:
= {
}
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=-1)
Widget part function for starting a new 'real' widget.
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
@ WID_H_BACKGROUND
Background of the window.
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:50

Definition at line 213 of file highscore_gui.cpp.