2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2009-01-03 18:44:20 +00:00
|
|
|
/** @file highscore.h Declaration of functions and types defined in highscore.h and highscore_gui.h */
|
|
|
|
|
|
|
|
#ifndef HIGHSCORE_H
|
|
|
|
#define HIGHSCORE_H
|
|
|
|
|
|
|
|
#include "strings_type.h"
|
|
|
|
#include "company_type.h"
|
2012-12-05 19:34:45 +00:00
|
|
|
#include "settings_type.h"
|
2009-01-03 18:44:20 +00:00
|
|
|
|
|
|
|
struct HighScore {
|
2023-06-04 09:14:56 +00:00
|
|
|
std::string name; ///< The name of the companyy and president.
|
|
|
|
StringID title = INVALID_STRING_ID; ///< NOSAVE, has troubles with changing string-numbers.
|
2023-05-08 17:01:06 +00:00
|
|
|
uint16_t score = 0; ///< The score for this high score. Do NOT change type, will break hs.dat
|
2009-01-03 18:44:20 +00:00
|
|
|
};
|
|
|
|
|
2023-06-04 09:14:56 +00:00
|
|
|
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
|
|
|
|
extern HighScoresTable _highscore_table;
|
2009-01-03 18:44:20 +00:00
|
|
|
|
|
|
|
void SaveToHighScore();
|
|
|
|
void LoadFromHighScore();
|
2023-06-04 09:14:56 +00:00
|
|
|
int8_t SaveHighScoreValue(const Company *c);
|
|
|
|
int8_t SaveHighScoreValueNetwork();
|
2009-01-03 18:44:20 +00:00
|
|
|
StringID EndGameGetPerformanceTitleFromValue(uint value);
|
2023-06-04 09:14:56 +00:00
|
|
|
void ShowHighscoreTable(int difficulty = SP_CUSTOM, int8_t rank = -1);
|
2009-01-03 18:44:20 +00:00
|
|
|
|
|
|
|
#endif /* HIGHSCORE_H */
|