diff options
Diffstat (limited to 'apps/plugins/solitaire.c')
-rw-r--r-- | apps/plugins/solitaire.c | 55 |
1 files changed, 17 insertions, 38 deletions
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index f9c2a63b52..80ef1af60d 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include "lib/configfile.h" | 24 | #include "lib/configfile.h" |
25 | #include "button.h" | 25 | #include "button.h" |
26 | #include "lcd.h" | 26 | #include "lcd.h" |
27 | #include "lib/oldmenuapi.h" | ||
28 | 27 | ||
29 | #ifdef HAVE_LCD_BITMAP | 28 | #ifdef HAVE_LCD_BITMAP |
30 | 29 | ||
@@ -773,15 +772,10 @@ static struct configdata config[] = { | |||
773 | { TYPE_INT, 0, 1, { .int_p = &sol_disk.draw_type }, "draw_type", NULL } | 772 | { TYPE_INT, 0, 1, { .int_p = &sol_disk.draw_type }, "draw_type", NULL } |
774 | }; | 773 | }; |
775 | 774 | ||
776 | char draw_option_string[32]; | 775 | static const struct opt_items drawcards[2] = { |
777 | 776 | { "Draw Three Cards", -1 }, | |
778 | static void create_draw_option_string(void) | 777 | { "Draw One Card", -1 }, |
779 | { | 778 | }; |
780 | if (sol.draw_type == 0) | ||
781 | rb->strcpy(draw_option_string, "Draw Three Cards"); | ||
782 | else | ||
783 | rb->strcpy(draw_option_string, "Draw One Card"); | ||
784 | } | ||
785 | 779 | ||
786 | void solitaire_init(void); | 780 | void solitaire_init(void); |
787 | 781 | ||
@@ -790,37 +784,22 @@ enum { MENU_RESUME, MENU_SAVE_AND_QUIT, MENU_QUIT, MENU_USB }; | |||
790 | 784 | ||
791 | int solitaire_menu(bool in_game) | 785 | int solitaire_menu(bool in_game) |
792 | { | 786 | { |
793 | int m; | 787 | int selected = 0; |
794 | int result = -1; | 788 | int result = -1; |
795 | int i = 0; | ||
796 | |||
797 | struct menu_item items[6]; | ||
798 | 789 | ||
799 | if( in_game ) | 790 | MENUITEM_STRINGLIST(menu, "Solitaire Menu", NULL, |
800 | { | 791 | "Start Game", "Draw Cards Option", |
801 | items[i++].desc = "Resume Game"; | 792 | "Help", "Audio Playback", "Quit"); |
802 | items[i++].desc = "Restart Game"; | 793 | MENUITEM_STRINGLIST(menu_in_game, "Solitaire Menu", NULL, |
803 | } | 794 | "Resume Game", "Restart Game", "Help", |
804 | else | 795 | "Audio Playback", "Save and Quit", "Quit"); |
805 | { | ||
806 | items[i++].desc = "Start Game"; | ||
807 | items[i++].desc = draw_option_string; | ||
808 | } | ||
809 | items[i++].desc = "Help"; | ||
810 | items[i++].desc = "Audio Playback"; | ||
811 | if( in_game ) | ||
812 | { | ||
813 | items[i++].desc = "Save and Quit"; | ||
814 | } | ||
815 | items[i++].desc = "Quit"; | ||
816 | 796 | ||
817 | create_draw_option_string(); | ||
818 | m = menu_init(items, i, NULL, NULL, NULL, NULL); | ||
819 | while (result < 0) | 797 | while (result < 0) |
820 | { | 798 | { |
821 | switch (menu_show(m)) | 799 | switch (rb->do_menu(in_game? &menu_in_game: &menu, |
800 | &selected, NULL, false)) | ||
822 | { | 801 | { |
823 | case MENU_SELECTED_EXIT: | 802 | default: |
824 | result = MENU_RESUME; | 803 | result = MENU_RESUME; |
825 | break; | 804 | break; |
826 | 805 | ||
@@ -840,8 +819,9 @@ int solitaire_menu(bool in_game) | |||
840 | } | 819 | } |
841 | else | 820 | else |
842 | { | 821 | { |
843 | sol.draw_type = (sol.draw_type + 1) % 2; | 822 | if (rb->set_option("Draw Cards Option", &sol.draw_type, |
844 | create_draw_option_string(); | 823 | INT, drawcards, 2, NULL)) |
824 | result = MENU_USB; | ||
845 | } | 825 | } |
846 | break; | 826 | break; |
847 | 827 | ||
@@ -866,7 +846,6 @@ int solitaire_menu(bool in_game) | |||
866 | break; | 846 | break; |
867 | } | 847 | } |
868 | } | 848 | } |
869 | menu_exit(m); | ||
870 | return result; | 849 | return result; |
871 | } | 850 | } |
872 | 851 | ||