OpenTTD Source 20241224-master-gf74b0cf984
|
Definition of functions used for highscore handling. More...
#include "stdafx.h"
#include "highscore.h"
#include "company_base.h"
#include "company_func.h"
#include "cheat_func.h"
#include "fileio_func.h"
#include "string_func.h"
#include "strings_func.h"
#include "table/strings.h"
#include "debug.h"
#include "safeguards.h"
Go to the source code of this file.
Functions | |
StringID | EndGameGetPerformanceTitleFromValue (uint value) |
int8_t | SaveHighScoreValue (const Company *c) |
Save the highscore for the company. | |
static bool | HighScoreSorter (const Company *const &a, const Company *const &b) |
Sort all companies given their performance. | |
int8_t | SaveHighScoreValueNetwork () |
Save the highscores in a network game when it has ended. | |
void | SaveToHighScore () |
Save HighScore table to file. | |
void | LoadFromHighScore () |
Initialize the highscore table to 0 and if any file exists, load in values. | |
Variables | |
HighScoresTable | _highscore_table |
Table with all the high scores. | |
std::string | _highscore_file |
The file to store the highscore data in. | |
static const StringID | _endgame_perf_titles [] |
Definition of functions used for highscore handling.
Definition in file highscore.cpp.
StringID EndGameGetPerformanceTitleFromValue | ( | uint | value | ) |
Definition at line 45 of file highscore.cpp.
Sort all companies given their performance.
Definition at line 80 of file highscore.cpp.
References CompanyProperties::old_economy, and CompanyEconomyEntry::performance_history.
Referenced by SaveHighScoreValueNetwork().
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.
|
static |
Definition at line 26 of file highscore.cpp.
std::string _highscore_file |
The file to store the highscore data in.
Definition at line 24 of file highscore.cpp.
Referenced by DeterminePaths(), LoadFromHighScore(), and SaveToHighScore().
HighScoresTable _highscore_table |
Table with all the high scores.
Definition at line 23 of file highscore.cpp.
Referenced by LoadFromHighScore(), HighScoreWindow::OnPaint(), SaveHighScoreValue(), SaveHighScoreValueNetwork(), and SaveToHighScore().