mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Fix #12973: Don't exclude high score after using sandbox
This commit is contained in:
parent
ce641af6a9
commit
d6aa09f96a
@ -20,20 +20,3 @@ void InitializeCheats()
|
|||||||
{
|
{
|
||||||
memset(&_cheats, 0, sizeof(Cheats));
|
memset(&_cheats, 0, sizeof(Cheats));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if any cheat has been used, false otherwise
|
|
||||||
* @return has a cheat been used?
|
|
||||||
*/
|
|
||||||
bool CheatHasBeenUsed()
|
|
||||||
{
|
|
||||||
/* Cannot use lengthof because _cheats is of type Cheats, not Cheat */
|
|
||||||
const Cheat *cht = (Cheat*)&_cheats;
|
|
||||||
const Cheat *cht_last = &cht[sizeof(_cheats) / sizeof(Cheat)];
|
|
||||||
|
|
||||||
for (; cht != cht_last; cht++) {
|
|
||||||
if (cht->been_used) return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
@ -16,6 +16,5 @@ extern Cheats _cheats;
|
|||||||
|
|
||||||
void ShowCheatWindow();
|
void ShowCheatWindow();
|
||||||
|
|
||||||
bool CheatHasBeenUsed();
|
|
||||||
|
|
||||||
#endif /* CHEAT_FUNC_H */
|
#endif /* CHEAT_FUNC_H */
|
||||||
|
@ -56,9 +56,6 @@ StringID EndGameGetPerformanceTitleFromValue(uint value)
|
|||||||
*/
|
*/
|
||||||
int8_t SaveHighScoreValue(const Company *c)
|
int8_t SaveHighScoreValue(const Company *c)
|
||||||
{
|
{
|
||||||
/* Exclude cheaters from the honour of being in the highscore table */
|
|
||||||
if (CheatHasBeenUsed()) return -1;
|
|
||||||
|
|
||||||
auto &highscores = _highscore_table[SP_CUSTOM];
|
auto &highscores = _highscore_table[SP_CUSTOM];
|
||||||
uint16_t score = c->old_economy[0].performance_history;
|
uint16_t score = c->old_economy[0].performance_history;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user