From 491851043156d5fc74a388b3cb5b7b95322b8e3e Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Thu, 8 Jan 2015 15:45:36 +0100 Subject: fix: the game stopped when we cancelled a root actin Signed-off-by: Olivier Gayot --- jouer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/jouer.c b/jouer.c index 1d14e0f..70795a8 100644 --- a/jouer.c +++ b/jouer.c @@ -80,7 +80,6 @@ enum action_state_t dig_entry(const struct entry_t *entries, int cnt_entries, st switch (event.key.keysym.sym) { case SDLK_a: case SDLK_ESCAPE: - update_list_entries(params->surfaces, params->positions, NULL, 0, -1); return ACTION_CANCELED; case SDLK_k: case SDLK_UP: @@ -96,11 +95,14 @@ enum action_state_t dig_entry(const struct entry_t *entries, int cnt_entries, st case SDLK_RETURN: target = &entries[selection]; if (!target->children_cnt) { - return target->f(params->surfaces, params->positions, params->t1, params->t2, target->data); - } + enum action_state_t state = target->f(params->surfaces, params->positions, params->t1, params->t2, target->data); - if (dig_entry(target->children, target->children_cnt, params) == ACTION_PERFORMED) - return ACTION_PERFORMED; + if (state == ACTION_PERFORMED) + return ACTION_PERFORMED; + } else { + if (dig_entry(target->children, target->children_cnt, params) == ACTION_PERFORMED) + return ACTION_PERFORMED; + } update_list_entries(params->surfaces, params->positions, entries, cnt_entries, selection); default: -- cgit v1.2.3