OpenTTD Source 20241224-master-gf74b0cf984
|
Declaration of functions and types defined in highscore.h and highscore_gui.h. More...
Go to the source code of this file.
Data Structures | |
struct | HighScore |
Typedefs | |
using | HighScores = std::array< HighScore, 5 > |
Record 5 high scores. | |
using | HighScoresTable = std::array< HighScores, SP_HIGHSCORE_END > |
Record high score for each of the difficulty levels. | |
Functions | |
void | SaveToHighScore () |
Save HighScore table to file. | |
void | LoadFromHighScore () |
Initialize the highscore table to 0 and if any file exists, load in values. | |
int8_t | SaveHighScoreValue (const Company *c) |
Save the highscore for the company. | |
int8_t | SaveHighScoreValueNetwork () |
Save the highscores in a network game when it has ended. | |
StringID | EndGameGetPerformanceTitleFromValue (uint value) |
void | ShowHighscoreTable (int difficulty=SP_CUSTOM, int8_t rank=-1) |
Show the highscore table for a given difficulty. | |
Variables | |
HighScoresTable | _highscore_table |
Table with all the high scores. | |
Declaration of functions and types defined in highscore.h and highscore_gui.h.
Definition in file highscore.h.
using HighScores = std::array<HighScore, 5> |
Record 5 high scores.
Definition at line 23 of file highscore.h.
using HighScoresTable = std::array<HighScores, SP_HIGHSCORE_END> |
Record high score for each of the difficulty levels.
Definition at line 24 of file highscore.h.
StringID EndGameGetPerformanceTitleFromValue | ( | uint | value | ) |
Definition at line 45 of file highscore.cpp.
void LoadFromHighScore | ( | ) |
Initialize the highscore table to 0 and if any file exists, load in values.
Definition at line 143 of file highscore.cpp.
References _highscore_file, _highscore_table, Debug, FileHandle::Open(), SP_SAVED_HIGHSCORE_END, and StrMakeValid().
Referenced by AfterNewGRFScan::OnNewGRFsScanned().
int8_t SaveHighScoreValue | ( | const Company * | c | ) |
Save the highscore for the company.
c | The company to insert. |
Definition at line 57 of file highscore.cpp.
References _highscore_table, GetString(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, CompanyProperties::old_economy, CompanyEconomyEntry::performance_history, SetDParam(), and SP_CUSTOM.
int8_t SaveHighScoreValueNetwork | ( | ) |
Save the highscores in a network game when it has ended.
Definition at line 89 of file highscore.cpp.
References _highscore_table, _local_company, GetString(), HighScoreSorter(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Iterate(), MAX_COMPANIES, CompanyProperties::old_economy, CompanyEconomyEntry::performance_history, SetDParam(), and SP_MULTIPLAYER.
void SaveToHighScore | ( | ) |
Save HighScore table to file.
Definition at line 120 of file highscore.cpp.
References _highscore_file, _highscore_table, Debug, FileHandle::Open(), and SP_SAVED_HIGHSCORE_END.
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().
|
extern |
Table with all the high scores.
Definition at line 23 of file highscore.cpp.
Referenced by LoadFromHighScore(), HighScoreWindow::OnPaint(), SaveHighScoreValue(), SaveHighScoreValueNetwork(), and SaveToHighScore().