diff options
-rw-r--r-- | apps/plugins/blackjack.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index bc7fb928e5..9e15d82822 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c | |||
@@ -955,7 +955,7 @@ static unsigned int blackjack_get_yes_no(char message[20]) { | |||
955 | case BJACK_SELECT: breakout = true; | 955 | case BJACK_SELECT: breakout = true; |
956 | break; | 956 | break; |
957 | case BJACK_QUIT: breakout = true; | 957 | case BJACK_QUIT: breakout = true; |
958 | choice = BJ_QUIT; | 958 | choice = 1; |
959 | break; | 959 | break; |
960 | } | 960 | } |
961 | } | 961 | } |
@@ -975,7 +975,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit, | |||
975 | signed int start) { | 975 | signed int start) { |
976 | int button; | 976 | int button; |
977 | char str[9]; | 977 | char str[9]; |
978 | bool changed = false; | 978 | bool breakout = false, changed = false; |
979 | unsigned int w, h; | 979 | unsigned int w, h; |
980 | signed int amount; | 980 | signed int amount; |
981 | 981 | ||
@@ -1035,7 +1035,7 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit, | |||
1035 | 37*w / 2, 8*h -3); | 1035 | 37*w / 2, 8*h -3); |
1036 | #endif | 1036 | #endif |
1037 | 1037 | ||
1038 | while(true) { | 1038 | while(!breakout) { |
1039 | button = rb->button_get(true); | 1039 | button = rb->button_get(true); |
1040 | 1040 | ||
1041 | switch(button) { | 1041 | switch(button) { |
@@ -1076,14 +1076,12 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit, | |||
1076 | changed = true; | 1076 | changed = true; |
1077 | break; | 1077 | break; |
1078 | case BJACK_QUIT: | 1078 | case BJACK_QUIT: |
1079 | return 0; | 1079 | breakout = true; |
1080 | amount = 0; | ||
1081 | break; | ||
1080 | case BJACK_SELECT: | 1082 | case BJACK_SELECT: |
1081 | #if LCD_DEPTH > 1 | 1083 | breakout = true; |
1082 | rb->lcd_set_foreground(FG_COLOR); | 1084 | break; |
1083 | rb->lcd_set_background(BG_COLOR); | ||
1084 | #endif | ||
1085 | rb->lcd_clear_display(); | ||
1086 | return amount; | ||
1087 | } | 1085 | } |
1088 | 1086 | ||
1089 | if(changed) { | 1087 | if(changed) { |
@@ -1101,6 +1099,13 @@ static signed int blackjack_get_amount(char message[20], signed int lower_limit, | |||
1101 | changed = false; | 1099 | changed = false; |
1102 | } | 1100 | } |
1103 | } | 1101 | } |
1102 | |||
1103 | #if LCD_DEPTH > 1 | ||
1104 | rb->lcd_set_foreground(FG_COLOR); | ||
1105 | rb->lcd_set_background(BG_COLOR); | ||
1106 | #endif | ||
1107 | rb->lcd_clear_display(); | ||
1108 | return amount; | ||
1104 | } | 1109 | } |
1105 | 1110 | ||
1106 | /***************************************************************************** | 1111 | /***************************************************************************** |
@@ -1127,7 +1132,7 @@ static void double_down(struct game_context* bj) { | |||
1127 | * means a split has already occurred and the first hand is done. | 1132 | * means a split has already occurred and the first hand is done. |
1128 | ******************************************************************************/ | 1133 | ******************************************************************************/ |
1129 | static void split(struct game_context* bj) { | 1134 | static void split(struct game_context* bj) { |
1130 | if (blackjack_get_yes_no("Split?") == 1) | 1135 | if (blackjack_get_yes_no("Split?") != 0) |
1131 | bj->split_status = 1; | 1136 | bj->split_status = 1; |
1132 | else { | 1137 | else { |
1133 | bj->split_status = 2; | 1138 | bj->split_status = 2; |
@@ -1149,7 +1154,7 @@ static unsigned int insurance(struct game_context* bj) { | |||
1149 | bj->asked_insurance = true; | 1154 | bj->asked_insurance = true; |
1150 | max_amount = bj->current_bet < (unsigned int)bj->player_money ? | 1155 | max_amount = bj->current_bet < (unsigned int)bj->player_money ? |
1151 | bj->current_bet/2 : (unsigned int)bj->player_money; | 1156 | bj->current_bet/2 : (unsigned int)bj->player_money; |
1152 | if (insurance == 1) return 0; | 1157 | if (insurance != 0) return 0; |
1153 | 1158 | ||
1154 | insurance = blackjack_get_amount("How much?", 0, max_amount, 0); | 1159 | insurance = blackjack_get_amount("How much?", 0, max_amount, 0); |
1155 | redraw_board(bj); | 1160 | redraw_board(bj); |
@@ -1275,8 +1280,8 @@ static int blackjack(struct game_context* bj) { | |||
1275 | bool dbl_down = false; | 1280 | bool dbl_down = false; |
1276 | 1281 | ||
1277 | #if LCD_DEPTH > 1 | 1282 | #if LCD_DEPTH > 1 |
1278 | rb->lcd_set_background(BG_COLOR); | 1283 | rb->lcd_set_background(BG_COLOR); |
1279 | rb->lcd_set_foreground(FG_COLOR); | 1284 | rb->lcd_set_foreground(FG_COLOR); |
1280 | #endif | 1285 | #endif |
1281 | 1286 | ||
1282 | /******************** | 1287 | /******************** |