From 7c7c03a2b9ecbd265d913c81b374e13eaa4f1078 Mon Sep 17 00:00:00 2001 From: Hristo Kovachev Date: Tue, 21 Mar 2006 11:18:40 +0000 Subject: Patch #4872 by Mikael Magnusson: fixes bubbles game overflowing stack git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9155 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/bubbles.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'apps/plugins') diff --git a/apps/plugins/bubbles.c b/apps/plugins/bubbles.c index f40f91ee58..03f3b767c9 100755 --- a/apps/plugins/bubbles.c +++ b/apps/plugins/bubbles.c @@ -1769,6 +1769,8 @@ static int bubbles_searchgroup(struct game_context* bb, int row, int col) { int adj = row%2; int mytype = bb->playboard[row][col].type; + if (bb->playboard[row][col].ingroup) + return 0; bb->playboard[row][col].ingroup = true; /* recursively call neighbors */ @@ -1875,6 +1877,8 @@ static int bubbles_remove(struct game_context* bb) { static void bubbles_anchored(struct game_context* bb, int row, int col) { int adj = row%2; + if (bb->playboard[row][col].anchored) + return; /* mark bubble */ bb->playboard[row][col].anchored = true; @@ -2289,7 +2293,6 @@ static int bubbles(struct game_context* bb) { int button; int buttonres; unsigned int startlevel = 0; - char str[30]; char *title = "Bubbles"; bool startgame = false; bool showscores = false; @@ -2304,6 +2307,7 @@ static int bubbles(struct game_context* bb) { * menu * ********************/ while(!startgame){ + char str[30]; rb->lcd_clear_display(); if(!showscores) { @@ -2466,7 +2470,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { struct game_context bb; bool exit = false; int position; - char str[19]; /* plugin init */ (void)parameter; @@ -2486,6 +2489,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { while(!exit) { switch(bubbles(&bb)){ + char str[19]; case BB_WIN: rb->splash(HZ*2, true, "You Win!"); -- cgit v1.2.3