players.c
changeset 1016 026b2de61647
parent 998 d9dc257b8949
child 1017 608592d4d7a6
--- a/players.c	Sat Jan 15 00:42:01 2005 +0000
+++ b/players.c	Sat Jan 15 00:46:45 2005 +0000
@@ -740,11 +740,25 @@
 	STR_0219_TYCOON_OF_THE_CENTURY,
 };
 
-inline StringID EndGameGetPerformanceTitleFromValue(uint value)
+StringID EndGameGetPerformanceTitleFromValue(uint value)
 {
 	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 */
 int8 SaveHighScoreValue(const Player *p)
 {
@@ -752,6 +766,10 @@
 	uint i;
 	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++) {
 		/* You are in the TOP5. Move all values one down and save us there */
 		if (hs[i].score <= score) {