summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-10-25 12:28:57 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-10-25 12:28:57 +0000
commit45a4381ff979f52a313a183fee3cb91e29d9e9e3 (patch)
tree45ecbf3530e07ca7d72a8f30523fdd4ce73854aa /apps
parent2df45f784f45a7d6b3c7a30bc45c3a0616dc9209 (diff)
downloadrockbox-45a4381ff979f52a313a183fee3cb91e29d9e9e3.tar.gz
rockbox-45a4381ff979f52a313a183fee3cb91e29d9e9e3.zip
Patch #1052007 by Philipp Pertermann, minesweeper no longer quits after finishing a game.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5343 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/minesweeper.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c
index e60cfb4688..81ed24096a 100644
--- a/apps/plugins/minesweeper.c
+++ b/apps/plugins/minesweeper.c
@@ -234,6 +234,7 @@ void minesweeper_init(void){
void minesweeper_putmines(int p, int x, int y){
int i,j;
+ mine_num = 0;
for(i=0;i<height;i++){
for(j=0;j<width;j++){
if(rb->rand()%100<p && !(y==i && x==j)){
@@ -470,26 +471,33 @@ int minesweeper(void)
/* plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
+ bool exit = false;
/* plugin init */
TEST_PLUGIN_API(api);
(void)parameter;
rb = api;
/* end of plugin init */
- switch(minesweeper()){
- case MINESWEEPER_WIN:
- rb->splash(HZ*2, true, "You Win :)");
- break;
-
- case MINESWEEPER_LOSE:
- rb->splash(HZ*2, true, "You Lost :(");
- break;
-
- case MINESWEEPER_USB:
- return PLUGIN_USB_CONNECTED;
-
- default:
- break;
+ while(!exit) {
+ switch(minesweeper()){
+ case MINESWEEPER_WIN:
+ rb->splash(HZ*2, true, "You Win :)");
+ break;
+
+ case MINESWEEPER_LOSE:
+ rb->splash(HZ*2, true, "You Lost :(");
+ break;
+
+ case MINESWEEPER_USB:
+ return PLUGIN_USB_CONNECTED;
+
+ case MINESWEEPER_QUIT:
+ exit = true;
+ break;
+
+ default:
+ break;
+ }
}
return PLUGIN_OK;