diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-10-25 12:28:57 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-10-25 12:28:57 +0000 |
commit | 45a4381ff979f52a313a183fee3cb91e29d9e9e3 (patch) | |
tree | 45ecbf3530e07ca7d72a8f30523fdd4ce73854aa | |
parent | 2df45f784f45a7d6b3c7a30bc45c3a0616dc9209 (diff) | |
download | rockbox-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
-rw-r--r-- | apps/plugins/minesweeper.c | 36 |
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){ | |||
234 | void minesweeper_putmines(int p, int x, int y){ | 234 | void minesweeper_putmines(int p, int x, int y){ |
235 | int i,j; | 235 | int i,j; |
236 | 236 | ||
237 | mine_num = 0; | ||
237 | for(i=0;i<height;i++){ | 238 | for(i=0;i<height;i++){ |
238 | for(j=0;j<width;j++){ | 239 | for(j=0;j<width;j++){ |
239 | if(rb->rand()%100<p && !(y==i && x==j)){ | 240 | if(rb->rand()%100<p && !(y==i && x==j)){ |
@@ -470,26 +471,33 @@ int minesweeper(void) | |||
470 | /* plugin entry point */ | 471 | /* plugin entry point */ |
471 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | 472 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) |
472 | { | 473 | { |
474 | bool exit = false; | ||
473 | /* plugin init */ | 475 | /* plugin init */ |
474 | TEST_PLUGIN_API(api); | 476 | TEST_PLUGIN_API(api); |
475 | (void)parameter; | 477 | (void)parameter; |
476 | rb = api; | 478 | rb = api; |
477 | /* end of plugin init */ | 479 | /* end of plugin init */ |
478 | 480 | ||
479 | switch(minesweeper()){ | 481 | while(!exit) { |
480 | case MINESWEEPER_WIN: | 482 | switch(minesweeper()){ |
481 | rb->splash(HZ*2, true, "You Win :)"); | 483 | case MINESWEEPER_WIN: |
482 | break; | 484 | rb->splash(HZ*2, true, "You Win :)"); |
483 | 485 | break; | |
484 | case MINESWEEPER_LOSE: | 486 | |
485 | rb->splash(HZ*2, true, "You Lost :("); | 487 | case MINESWEEPER_LOSE: |
486 | break; | 488 | rb->splash(HZ*2, true, "You Lost :("); |
487 | 489 | break; | |
488 | case MINESWEEPER_USB: | 490 | |
489 | return PLUGIN_USB_CONNECTED; | 491 | case MINESWEEPER_USB: |
490 | 492 | return PLUGIN_USB_CONNECTED; | |
491 | default: | 493 | |
492 | break; | 494 | case MINESWEEPER_QUIT: |
495 | exit = true; | ||
496 | break; | ||
497 | |||
498 | default: | ||
499 | break; | ||
500 | } | ||
493 | } | 501 | } |
494 | 502 | ||
495 | return PLUGIN_OK; | 503 | return PLUGIN_OK; |