Merge pull request #167 from voloved/blackjack_face
Fix Win-Lose Ratio and Reset it
This commit is contained in:
commit
bd28a76233
@ -277,7 +277,7 @@ static void display_win_ratio(blackjack_face_state_t *state) {
|
||||
game_state = BJ_WIN_RATIO;
|
||||
uint8_t win_ratio = 0;
|
||||
if (state->games_played > 0) { // Avoid dividing by zero
|
||||
win_ratio = (uint8_t)(100 * state->games_won) / state->games_played;
|
||||
win_ratio = (uint8_t)((100 * state->games_won) / state->games_played);
|
||||
}
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, " ");
|
||||
watch_display_text_with_fallback(WATCH_POSITION_TOP, "WINS ", "WR");
|
||||
@ -444,6 +444,11 @@ bool blackjack_face_loop(movement_event_t event, void *context) {
|
||||
case EVENT_ALARM_LONG_PRESS:
|
||||
if (game_state == BJ_TITLE_SCREEN) {
|
||||
toggle_tap_control(state);
|
||||
} else if (game_state == BJ_WIN_RATIO) {
|
||||
// Reset the win-lose ratio
|
||||
state->games_won = 0;
|
||||
state->games_played = 0;
|
||||
watch_display_text(WATCH_POSITION_BOTTOM, " 0Pct");
|
||||
}
|
||||
break;
|
||||
case EVENT_TIMEOUT:
|
||||
|
||||
@ -63,6 +63,7 @@
|
||||
*
|
||||
* Long-pressing the LIGHT button on the Title Screen will display your win rate as a percentage of games finished.
|
||||
* It displays as games won / (games won + games lost) it does not include incomplete nor tied games.
|
||||
* You can reset the win rate on that screen by long-pressing the ALARM button.
|
||||
*
|
||||
* | Cards | |
|
||||
* |---------|--------------------------|
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user