summaryrefslogtreecommitdiff
path: root/jouer.c
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-01-08 15:45:36 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-01-08 15:45:36 +0100
commit491851043156d5fc74a388b3cb5b7b95322b8e3e (patch)
tree6dd548659a63adbd358b336ed772e79f83a04237 /jouer.c
parent9b863d19acd0497f6cb9c0d3bff59765ef1abaa8 (diff)
fix: the game stopped when we cancelled a root actin
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'jouer.c')
-rw-r--r--jouer.c12
1 files 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: