forked from len0rd/rockbox
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
This commit is contained in:
parent
2df45f784f
commit
45a4381ff9
1 changed files with 22 additions and 14 deletions
|
@ -234,6 +234,7 @@ void minesweeper_init(void){
|
||||||
void minesweeper_putmines(int p, int x, int y){
|
void minesweeper_putmines(int p, int x, int y){
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
|
mine_num = 0;
|
||||||
for(i=0;i<height;i++){
|
for(i=0;i<height;i++){
|
||||||
for(j=0;j<width;j++){
|
for(j=0;j<width;j++){
|
||||||
if(rb->rand()%100<p && !(y==i && x==j)){
|
if(rb->rand()%100<p && !(y==i && x==j)){
|
||||||
|
@ -470,26 +471,33 @@ int minesweeper(void)
|
||||||
/* plugin entry point */
|
/* plugin entry point */
|
||||||
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
|
||||||
{
|
{
|
||||||
|
bool exit = false;
|
||||||
/* plugin init */
|
/* plugin init */
|
||||||
TEST_PLUGIN_API(api);
|
TEST_PLUGIN_API(api);
|
||||||
(void)parameter;
|
(void)parameter;
|
||||||
rb = api;
|
rb = api;
|
||||||
/* end of plugin init */
|
/* end of plugin init */
|
||||||
|
|
||||||
switch(minesweeper()){
|
while(!exit) {
|
||||||
case MINESWEEPER_WIN:
|
switch(minesweeper()){
|
||||||
rb->splash(HZ*2, true, "You Win :)");
|
case MINESWEEPER_WIN:
|
||||||
break;
|
rb->splash(HZ*2, true, "You Win :)");
|
||||||
|
break;
|
||||||
case MINESWEEPER_LOSE:
|
|
||||||
rb->splash(HZ*2, true, "You Lost :(");
|
case MINESWEEPER_LOSE:
|
||||||
break;
|
rb->splash(HZ*2, true, "You Lost :(");
|
||||||
|
break;
|
||||||
case MINESWEEPER_USB:
|
|
||||||
return PLUGIN_USB_CONNECTED;
|
case MINESWEEPER_USB:
|
||||||
|
return PLUGIN_USB_CONNECTED;
|
||||||
default:
|
|
||||||
break;
|
case MINESWEEPER_QUIT:
|
||||||
|
exit = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return PLUGIN_OK;
|
return PLUGIN_OK;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue