diff options
Diffstat (limited to 'apps/plugins/chessclock.c')
-rw-r--r-- | apps/plugins/chessclock.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index a69b3bb582..514cac174e 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c | |||
@@ -367,17 +367,22 @@ enum plugin_status plugin_start(const void* parameter) | |||
367 | do { | 367 | do { |
368 | int ret=0; | 368 | int ret=0; |
369 | done=true; | 369 | done=true; |
370 | for (i=0; done && i<settings.nr_timers; i++) { | 370 | i = nr; |
371 | do { | ||
371 | if (!timer_holder[i].hidden) | 372 | if (!timer_holder[i].hidden) |
372 | done=false; | 373 | { |
373 | } | 374 | nr = i; |
375 | done = false; | ||
376 | break; | ||
377 | } | ||
378 | if (++i == settings.nr_timers) | ||
379 | i = 0; | ||
380 | } while (i != nr); | ||
381 | |||
374 | if (done) { | 382 | if (done) { |
375 | return PLUGIN_OK; | 383 | return PLUGIN_OK; |
376 | } | 384 | } |
377 | if (!timer_holder[nr].hidden) { | 385 | ret = run_timer(nr); |
378 | done=false; | ||
379 | ret=run_timer(nr); | ||
380 | } | ||
381 | switch (ret) { | 386 | switch (ret) { |
382 | case -1: /* exit */ | 387 | case -1: /* exit */ |
383 | done=true; | 388 | done=true; |
@@ -390,9 +395,11 @@ enum plugin_status plugin_start(const void* parameter) | |||
390 | nr=0; | 395 | nr=0; |
391 | break; | 396 | break; |
392 | case 2: | 397 | case 2: |
393 | nr--; | 398 | do { |
394 | if (nr<0) | 399 | nr--; |
395 | nr=settings.nr_timers-1; | 400 | if (nr<0) |
401 | nr=settings.nr_timers-1; | ||
402 | } while (timer_holder[nr].hidden); | ||
396 | break; | 403 | break; |
397 | } | 404 | } |
398 | } while (!done); | 405 | } while (!done); |
@@ -521,7 +528,7 @@ static int run_timer(int nr) | |||
521 | switch(rb->do_menu(&menu, NULL, NULL, false)) | 528 | switch(rb->do_menu(&menu, NULL, NULL, false)) |
522 | { | 529 | { |
523 | case 0: | 530 | case 0: |
524 | /* delete timer */ | 531 | /* delete player */ |
525 | timer_holder[nr].hidden=true; | 532 | timer_holder[nr].hidden=true; |
526 | retval=1; | 533 | retval=1; |
527 | done=true; | 534 | done=true; |