summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-08-02 23:26:02 +0000
committerThomas Martitz <kugel@rockbox.org>2009-08-02 23:26:02 +0000
commitbbc9aebae3ec6e900abdf257a0b377a0f5b45911 (patch)
treeb5740ecea7f315cd756dee423cdf06478a034822
parent5c09d3741a9654c0f79d04a2d672e579cc7e5539 (diff)
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
-rw-r--r--apps/plugins/bubbles.c11
1 files changed, 5 insertions, 6 deletions
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;