plugins: Fix issues in 2048

One of these was an unintentional fallthrough -- if you said no to
'quit without saving' it would save and quit.

Change-Id: I33828b58962a05adab65ac5f71dd0e2b1e07001b
This commit is contained in:
Aidan MacDonald 2021-07-24 18:28:28 +01:00
parent 005c414e5f
commit bdd9c8dfc8

View file

@ -811,8 +811,7 @@ static int do_2048_pause_menu(void)
"Help", "Help",
"Quit without Saving", "Quit without Saving",
"Quit"); "Quit");
bool quit = false; while(1)
while(!quit)
{ {
switch(rb->do_menu(&menu, &sel, NULL, false)) switch(rb->do_menu(&menu, &sel, NULL, false))
{ {
@ -849,9 +848,10 @@ static int do_2048_pause_menu(void)
} }
case 6: case 6:
return 3; return 3;
default:
break;
} }
} }
return 0;
} }
static void exit_handler(void) static void exit_handler(void)
@ -1017,8 +1017,7 @@ static enum plugin_status do_2048_menu(void)
"Help", "Help",
"Quit without Saving", "Quit without Saving",
"Quit"); "Quit");
bool quit = false; while(true)
while(!quit)
{ {
switch(rb->do_menu(&menu, &sel, NULL, false)) switch(rb->do_menu(&menu, &sel, NULL, false))
{ {
@ -1065,6 +1064,7 @@ static enum plugin_status do_2048_menu(void)
case 5: case 5:
if(confirm_quit()) if(confirm_quit())
return PLUGIN_OK; return PLUGIN_OK;
break;
case 6: case 6:
if(loaded) if(loaded)
save_game(); save_game();
@ -1073,7 +1073,6 @@ static enum plugin_status do_2048_menu(void)
break; break;
} }
} }
return PLUGIN_OK;
} }
/* plugin entry point */ /* plugin entry point */