From a2a7eba72c088c4a9bbb2f3abf14497d3487d1be Mon Sep 17 00:00:00 2001 From: Barry Wardell Date: Wed, 18 Oct 2006 00:06:08 +0000 Subject: Fix off-by-1 error in Bubbles level recording when you win. FS#6127. Thanks to Dave Hooper for the patch. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11252 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/bubbles.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'apps') diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index 45105feaf6..ae06c1e2a4 100755 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c @@ -2274,6 +2274,9 @@ static void bubbles_loadscores(struct game_context* bb) { /* scores are bad, reset */ rb->memset(bb->highscores, 0, sizeof(bb->highscores)); } + + if( bb->highlevel >= NUM_LEVELS ) + bb->highlevel = NUM_LEVELS - 1; rb->close(fd); } @@ -2694,8 +2697,8 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { case BB_WIN: rb->splash(HZ*2, true, "You Win!"); /* record high level */ - if(bb.level-1 > bb.highlevel) { - bb.highlevel = bb.level-1; + if( NUM_LEVELS-1 > bb.highlevel) { + bb.highlevel = NUM_LEVELS-1; bb.dirty = true; } -- cgit v1.2.3