OpenTTD Source  1.11.0-beta2
highscore.cpp File Reference
#include "stdafx.h"
#include "highscore.h"
#include "company_base.h"
#include "company_func.h"
#include "cheat_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 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 SaveHighScoreValueNetwork ()
 Save the highscores in a network game when it has ended. More...
 
void SaveToHighScore ()
 Save HighScore table to file.
 
void LoadFromHighScore ()
 Initialize the highscore table to 0 and if any file exists, load in values.
 

Variables

HighScore _highscore_table [SP_HIGHSCORE_END][5]
 various difficulty-settings; top 5
 
std::string _highscore_file
 The file to store the highscore data in.
 
static const StringID _endgame_perf_titles []
 

Detailed Description

Definition of functions used for highscore handling

Definition in file highscore.cpp.

Function Documentation

◆ SaveHighScoreValueNetwork()

int8 SaveHighScoreValueNetwork ( )

Save the highscores in a network game when it has ended.

Returns
Position of the local company in the highscore list.

Definition at line 88 of file highscore.cpp.

References _highscore_table, HighScoreSorter(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Iterate(), lengthof, MAX_COMPANIES, SetDParam(), and SP_MULTIPLAYER.

Variable Documentation

◆ _endgame_perf_titles

const StringID _endgame_perf_titles[]
static
Initial value:
= {
STR_HIGHSCORE_PERFORMANCE_TITLE_BUSINESSMAN,
STR_HIGHSCORE_PERFORMANCE_TITLE_BUSINESSMAN,
STR_HIGHSCORE_PERFORMANCE_TITLE_BUSINESSMAN,
STR_HIGHSCORE_PERFORMANCE_TITLE_BUSINESSMAN,
STR_HIGHSCORE_PERFORMANCE_TITLE_BUSINESSMAN,
STR_HIGHSCORE_PERFORMANCE_TITLE_ENTREPRENEUR,
STR_HIGHSCORE_PERFORMANCE_TITLE_ENTREPRENEUR,
STR_HIGHSCORE_PERFORMANCE_TITLE_INDUSTRIALIST,
STR_HIGHSCORE_PERFORMANCE_TITLE_INDUSTRIALIST,
STR_HIGHSCORE_PERFORMANCE_TITLE_CAPITALIST,
STR_HIGHSCORE_PERFORMANCE_TITLE_CAPITALIST,
STR_HIGHSCORE_PERFORMANCE_TITLE_MAGNATE,
STR_HIGHSCORE_PERFORMANCE_TITLE_MAGNATE,
STR_HIGHSCORE_PERFORMANCE_TITLE_MOGUL,
STR_HIGHSCORE_PERFORMANCE_TITLE_MOGUL,
STR_HIGHSCORE_PERFORMANCE_TITLE_TYCOON_OF_THE_CENTURY
}

Definition at line 25 of file highscore.cpp.