From bbc9aebae3ec6e900abdf257a0b377a0f5b45911 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 2 Aug 2009 23:26:02 +0000 Subject: Fix highest succeeded level from the highscores really this time, and don't confuse MIN() and MAX(). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22125 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/bubbles.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'apps') diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index d0da61f446..64ab258240 100644 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c @@ -2183,11 +2183,12 @@ static void bubbles_loadscores(struct game_context* bb) { /* highlevel and highscores */ highscore_load(SCORE_FILE, highscores, NUM_SCORES); + /* level X in the high scores means one succeeded the level before (X-1) */ for (i = 0; i < NUM_SCORES; i++) { - if (highscores[i].level > highlevel) + if (highscores[i].level-1 > highlevel) { - highlevel = highscores[i].level; + highlevel = highscores[i].level-1; } } @@ -2392,7 +2393,7 @@ static int bubbles(struct game_context* bb) { case 2: /* choose level */ startlevel++; rb->set_int("Choose start level", "", UNIT_INT, &startlevel, - NULL, 1, 1, MAX(NUM_LEVELS,bb->highlevel+1), NULL); + NULL, 1, 1, MIN(NUM_LEVELS,bb->highlevel+1), NULL); startlevel--; break; case 3: /* High scores */ @@ -2483,9 +2484,7 @@ enum plugin_status plugin_start(const void* parameter) { case BB_WIN: rb->splash(HZ*2, "You Win!"); /* record high level */ - if( NUM_LEVELS-1 > bb.highlevel) { - bb.highlevel = NUM_LEVELS-1; - } + bb.highlevel = NUM_LEVELS; /* record high score */ bubbles_recordscore(&bb); break; -- cgit v1.2.3