mirror of https://github.com/OpenTTD/OpenTTD
(svn r1516) -Cheating players do not get their names added to the highscore table/file
-Fixed issue where highscore window would not come up after endgame screen -Fix: VS6 compiles once again (braindead compiler)release/0.4.5
parent
c3a40dba68
commit
75474e5bf1
|
@ -796,8 +796,8 @@ static void EndGameWndProc(Window *w, WindowEvent *e)
|
||||||
} break;
|
} break;
|
||||||
case WE_CLICK: /* OnClick show the highscore chart */
|
case WE_CLICK: /* OnClick show the highscore chart */
|
||||||
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
|
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
|
||||||
ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank);
|
|
||||||
DeleteWindow(w);
|
DeleteWindow(w);
|
||||||
|
ShowHighscoreTable(w->window_number, WP(w, highscore_d).rank);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
20
players.c
20
players.c
|
@ -740,11 +740,25 @@ static const StringID _endgame_performance_titles[16] = {
|
||||||
STR_0219_TYCOON_OF_THE_CENTURY,
|
STR_0219_TYCOON_OF_THE_CENTURY,
|
||||||
};
|
};
|
||||||
|
|
||||||
inline StringID EndGameGetPerformanceTitleFromValue(uint value)
|
StringID EndGameGetPerformanceTitleFromValue(uint value)
|
||||||
{
|
{
|
||||||
return _endgame_performance_titles[minu(value, 1000) >> 6];
|
return _endgame_performance_titles[minu(value, 1000) >> 6];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return true if any cheat has been used, false otherwise */
|
||||||
|
static CheatHasBeenUsed(void)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/* Save the highscore for the player */
|
/* Save the highscore for the player */
|
||||||
int8 SaveHighScoreValue(const Player *p)
|
int8 SaveHighScoreValue(const Player *p)
|
||||||
{
|
{
|
||||||
|
@ -752,6 +766,10 @@ int8 SaveHighScoreValue(const Player *p)
|
||||||
uint i;
|
uint i;
|
||||||
uint16 score = p->old_economy[0].performance_history;
|
uint16 score = p->old_economy[0].performance_history;
|
||||||
|
|
||||||
|
/* Exclude cheaters from the honour of being in the highscore table */
|
||||||
|
if (CheatHasBeenUsed())
|
||||||
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < lengthof(_highscore_table[0]); i++) {
|
for (i = 0; i < lengthof(_highscore_table[0]); i++) {
|
||||||
/* You are in the TOP5. Move all values one down and save us there */
|
/* You are in the TOP5. Move all values one down and save us there */
|
||||||
if (hs[i].score <= score) {
|
if (hs[i].score <= score) {
|
||||||
|
|
Loading…
Reference in New Issue