OpenTTD

highscore.h
Go to the documentation of this file.
1 /* $Id: highscore.h 25512 2013-06-29 12:07:40Z rubidium $ */
2
3 /*
4 * This file is part of OpenTTD.
5 * 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.
6 * 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.
7 * 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/>.
8 */
9
12 #ifndef HIGHSCORE_H
13 #define HIGHSCORE_H
14
15 #include "strings_type.h"
16 #include "company_type.h"
17 #include "settings_type.h"
18
19 struct HighScore {
25 char company[(MAX_LENGTH_COMPANY_NAME_CHARS + MAX_LENGTH_PRESIDENT_NAME_CHARS + 5) * MAX_CHAR_LENGTH];
26 StringID title;
27 uint16 score;
28 };
29
30 extern HighScore _highscore_table[SP_HIGHSCORE_END][5];
31
32 void SaveToHighScore();
33 void LoadFromHighScore();
34 int8 SaveHighScoreValue(const Company *c);
35 int8 SaveHighScoreValueNetwork();
36 StringID EndGameGetPerformanceTitleFromValue(uint value);
37 void ShowHighscoreTable(int difficulty = SP_CUSTOM, int8 rank = -1);
38
39 #endif /* HIGHSCORE_H */
SaveHighScoreValueNetwork
int8 SaveHighScoreValueNetwork()
Save the highscores in a network game when it has ended.
Definition: highscore.cpp:91
HighScore::title
StringID title
NOSAVE, has troubles with changing string-numbers.
Definition: highscore.h:26
SP_CUSTOM
No profile, special "custom" highscore.
Definition: settings_type.h:35
MAX_LENGTH_PRESIDENT_NAME_CHARS
static const uint MAX_LENGTH_PRESIDENT_NAME_CHARS
The maximum length of a president name in characters including &#39;\0&#39;.
Definition: company_type.h:41
HighScore
Definition: highscore.h:19
MAX_CHAR_LENGTH
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
Definition: strings_type.h:20
settings_type.h
Types related to global configuration settings.
MAX_LENGTH_COMPANY_NAME_CHARS
static const uint MAX_LENGTH_COMPANY_NAME_CHARS
The maximum length of a company name in characters including &#39;\0&#39;.
Definition: company_type.h:42
LoadFromHighScore
void LoadFromHighScore()
Initialize the highscore table to 0 and if any file exists, load in values.
Definition: highscore.cpp:156
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:25
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:18
ShowHighscoreTable
void ShowHighscoreTable(int difficulty=SP_CUSTOM, int8 rank=-1)
Show the highscore table for a given difficulty.
Definition: highscore_gui.cpp:231
HighScore::score
uint16 score
The score for this high score. Do NOT change type, will break hs.dat.
Definition: highscore.h:27
Company
Definition: company_base.h:110
_highscore_table
HighScore _highscore_table[SP_HIGHSCORE_END][5]
various difficulty-settings; top 5
Definition: highscore.cpp:25
SaveToHighScore
void SaveToHighScore()
Save HighScore table to file.
Definition: highscore.cpp:128
company_type.h
Types related to companies.
strings_type.h
Types related to strings.
SP_HIGHSCORE_END
End of highscore tables.
Definition: settings_type.h:39
SaveHighScoreValue
int8 SaveHighScoreValue(const Company *c)
Save the highscore for the company.
Definition: highscore.cpp:55