Bugfix on elements not resetting when winning or losing

This commit is contained in:
David Volovskiy 2024-08-19 00:13:18 -04:00
parent 0d58f0d77d
commit 1a1560b59d

View File

@ -502,7 +502,7 @@ static void get_result(wordle_state_t *state) {
state->guessed_words[state->attempt] = in_dict; state->guessed_words[state->attempt] = in_dict;
bool exact_match = check_word(state); bool exact_match = check_word(state);
if (exact_match) { if (exact_match) {
state->attempt = 0; reset_all_elements(state);
state->curr_screen = SCREEN_WIN; state->curr_screen = SCREEN_WIN;
if (state->streak < 0x7F) if (state->streak < 0x7F)
state->streak++; state->streak++;
@ -512,7 +512,7 @@ static void get_result(wordle_state_t *state) {
return; return;
} }
if (++state->attempt >= WORDLE_MAX_ATTEMPTS) { if (++state->attempt >= WORDLE_MAX_ATTEMPTS) {
state->attempt = 0; reset_all_elements(state);
state->curr_screen = SCREEN_LOSE; state->curr_screen = SCREEN_LOSE;
state->streak = 0; state->streak = 0;
return; return;
@ -560,7 +560,7 @@ void wordle_face_activate(movement_settings_t *settings, void *context) {
#if USE_DAILY_STREAK #if USE_DAILY_STREAK
uint32_t now = get_day_unix_time() ; uint32_t now = get_day_unix_time() ;
if (state->prev_day <= (now + (60 *60 * 24))) state->streak = 0; if (state->prev_day <= (now + (60 *60 * 24))) state->streak = 0;
if (state->curr_day != now) state->attempt = 0; if (state->curr_day != now) reset_all_elements(state);
#endif #endif
state->using_random_guess = false; state->using_random_guess = false;
if (is_playing(state) && state->curr_screen >= SCREEN_RESULT) { if (is_playing(state) && state->curr_screen >= SCREEN_RESULT) {