forked from len0rd/rockbox
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
This commit is contained in:
parent
d694a21b7f
commit
7c7c03a2b9
1 changed files with 6 additions and 2 deletions
|
|
@ -1769,6 +1769,8 @@ static int bubbles_searchgroup(struct game_context* bb, int row, int col) {
|
||||||
int adj = row%2;
|
int adj = row%2;
|
||||||
int mytype = bb->playboard[row][col].type;
|
int mytype = bb->playboard[row][col].type;
|
||||||
|
|
||||||
|
if (bb->playboard[row][col].ingroup)
|
||||||
|
return 0;
|
||||||
bb->playboard[row][col].ingroup = true;
|
bb->playboard[row][col].ingroup = true;
|
||||||
|
|
||||||
/* recursively call neighbors */
|
/* 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) {
|
static void bubbles_anchored(struct game_context* bb, int row, int col) {
|
||||||
int adj = row%2;
|
int adj = row%2;
|
||||||
|
|
||||||
|
if (bb->playboard[row][col].anchored)
|
||||||
|
return;
|
||||||
/* mark bubble */
|
/* mark bubble */
|
||||||
bb->playboard[row][col].anchored = true;
|
bb->playboard[row][col].anchored = true;
|
||||||
|
|
||||||
|
|
@ -2289,7 +2293,6 @@ static int bubbles(struct game_context* bb) {
|
||||||
int button;
|
int button;
|
||||||
int buttonres;
|
int buttonres;
|
||||||
unsigned int startlevel = 0;
|
unsigned int startlevel = 0;
|
||||||
char str[30];
|
|
||||||
char *title = "Bubbles";
|
char *title = "Bubbles";
|
||||||
bool startgame = false;
|
bool startgame = false;
|
||||||
bool showscores = false;
|
bool showscores = false;
|
||||||
|
|
@ -2304,6 +2307,7 @@ static int bubbles(struct game_context* bb) {
|
||||||
* menu *
|
* menu *
|
||||||
********************/
|
********************/
|
||||||
while(!startgame){
|
while(!startgame){
|
||||||
|
char str[30];
|
||||||
rb->lcd_clear_display();
|
rb->lcd_clear_display();
|
||||||
|
|
||||||
if(!showscores) {
|
if(!showscores) {
|
||||||
|
|
@ -2466,7 +2470,6 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
|
||||||
struct game_context bb;
|
struct game_context bb;
|
||||||
bool exit = false;
|
bool exit = false;
|
||||||
int position;
|
int position;
|
||||||
char str[19];
|
|
||||||
|
|
||||||
/* plugin init */
|
/* plugin init */
|
||||||
(void)parameter;
|
(void)parameter;
|
||||||
|
|
@ -2486,6 +2489,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
|
||||||
|
|
||||||
while(!exit) {
|
while(!exit) {
|
||||||
switch(bubbles(&bb)){
|
switch(bubbles(&bb)){
|
||||||
|
char str[19];
|
||||||
case BB_WIN:
|
case BB_WIN:
|
||||||
rb->splash(HZ*2, true, "You Win!");
|
rb->splash(HZ*2, true, "You Win!");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue