Skip to content

Commit

Permalink
Handle cheats in highscore registration
Browse files Browse the repository at this point in the history
  • Loading branch information
fexed committed Jul 7, 2022
1 parent 2ffef15 commit 9da9073
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ public class HighScoreHandler {
static boolean postHighScore(Context context, int score) {
SharedPreferences prefs = context.getSharedPreferences("com.fexed.spacecadetpinball", Context.MODE_PRIVATE);

int oldscore = prefs.getInt("highscore", 0);
if (score > oldscore) {
prefs.edit().putInt("highscore", score).apply();
return true;
if (!prefs.getBoolean("cheatsused", true)) {
int oldscore = prefs.getInt("highscore", 0);
if (score > oldscore) {
prefs.edit().putInt("highscore", score).apply();
return true;
}
}

return false;
}

Expand Down

0 comments on commit 9da9073

Please sign in to comment.