OpenTTD Source: src/highscore.h Source File

OpenTTD Source 13.1

highscore.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
10 #ifndef HIGHSCORE_H
11 #define HIGHSCORE_H
12
13 #include "strings_type.h"
14 #include "company_type.h"
15 #include "settings_type.h"
16
17 struct HighScore {
23 char company[(MAX_LENGTH_COMPANY_NAME_CHARS + MAX_LENGTH_PRESIDENT_NAME_CHARS + 5) * MAX_CHAR_LENGTH];
24 StringID title;
25 uint16 score;
26 };
27
28 extern HighScore _highscore_table[SP_HIGHSCORE_END][5];
29
30 void SaveToHighScore();
31 void LoadFromHighScore();
32 int8 SaveHighScoreValue(const Company *c);
33 int8 SaveHighScoreValueNetwork();
34 StringID EndGameGetPerformanceTitleFromValue(uint value);
35 void ShowHighscoreTable(int difficulty = SP_CUSTOM, int8 rank = -1);
36
37 #endif /* HIGHSCORE_H */
HighScore
Definition: highscore.h:17
SaveHighScoreValueNetwork
int8 SaveHighScoreValueNetwork()
Save the highscores in a network game when it has ended.
Definition: highscore.cpp:88
strings_type.h
HighScore::company
char company[(MAX_LENGTH_COMPANY_NAME_CHARS+MAX_LENGTH_PRESIDENT_NAME_CHARS+5) *MAX_CHAR_LENGTH]
The name of the company and president.
Definition: highscore.h:23
HighScore::title
StringID title
NOSAVE, has troubles with changing string-numbers.
Definition: highscore.h:24
MAX_CHAR_LENGTH
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
Definition: strings_type.h:18
SaveHighScoreValue
int8 SaveHighScoreValue(const Company *c)
Save the highscore for the company.
Definition: highscore.cpp:52
MAX_LENGTH_COMPANY_NAME_CHARS
static const uint MAX_LENGTH_COMPANY_NAME_CHARS
The maximum length of a company name in characters including '\0'.
Definition: company_type.h:40
MAX_LENGTH_PRESIDENT_NAME_CHARS
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS
The maximum length of a president name in characters including '\0'.
Definition: company_type.h:39
SP_CUSTOM
@ SP_CUSTOM
No profile, special "custom" highscore.
Definition: settings_type.h:45
SP_HIGHSCORE_END
@ SP_HIGHSCORE_END
End of highscore tables.
Definition: settings_type.h:49
settings_type.h
HighScore::score
uint16 score
The score for this high score. Do NOT change type, will break hs.dat.
Definition: highscore.h:25
ShowHighscoreTable
void ShowHighscoreTable(int difficulty=SP_CUSTOM, int8 rank=-1)
Show the highscore table for a given difficulty.
Definition: highscore_gui.cpp:234
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
SaveToHighScore
void SaveToHighScore()
Save HighScore table to file.
Definition: highscore.cpp:124
LoadFromHighScore
void LoadFromHighScore()
Initialize the highscore table to 0 and if any file exists, load in values.
Definition: highscore.cpp:152
_highscore_table
HighScore _highscore_table[SP_HIGHSCORE_END][5]
various difficulty-settings; top 5
Definition: highscore.cpp:22
Company
Definition: company_base.h:117
company_type.h