summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/midend.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/midend.c')
-rw-r--r--apps/plugins/puzzles/src/midend.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/apps/plugins/puzzles/src/midend.c b/apps/plugins/puzzles/src/midend.c
index f80a7fa19f..09b59b25e2 100644
--- a/apps/plugins/puzzles/src/midend.c
+++ b/apps/plugins/puzzles/src/midend.c
@@ -590,33 +590,40 @@ static int midend_really_process_key(midend *me, int x, int y, int button)
590 int type = MOVE, gottype = FALSE, ret = 1; 590 int type = MOVE, gottype = FALSE, ret = 1;
591 float anim_time; 591 float anim_time;
592 game_state *s; 592 game_state *s;
593 char *movestr; 593 char *movestr = NULL;
594 594
595 movestr = 595 if (!IS_UI_FAKE_KEY(button)) {
596 me->ourgame->interpret_move(me->states[me->statepos-1].state, 596 movestr = me->ourgame->interpret_move(
597 me->ui, me->drawstate, x, y, button); 597 me->states[me->statepos-1].state,
598 me->ui, me->drawstate, x, y, button);
599 }
598 600
599 if (!movestr) { 601 if (!movestr) {
600 if (button == 'n' || button == 'N' || button == '\x0E') { 602 if (button == 'n' || button == 'N' || button == '\x0E' ||
603 button == UI_NEWGAME) {
601 midend_new_game(me); 604 midend_new_game(me);
602 midend_redraw(me); 605 midend_redraw(me);
603 goto done; /* never animate */ 606 goto done; /* never animate */
604 } else if (button == 'u' || button == 'U' || 607 } else if (button == 'u' || button == 'U' ||
605 button == '\x1A' || button == '\x1F') { 608 button == '\x1A' || button == '\x1F' ||
609 button == UI_UNDO) {
606 midend_stop_anim(me); 610 midend_stop_anim(me);
607 type = me->states[me->statepos-1].movetype; 611 type = me->states[me->statepos-1].movetype;
608 gottype = TRUE; 612 gottype = TRUE;
609 if (!midend_undo(me)) 613 if (!midend_undo(me))
610 goto done; 614 goto done;
611 } else if (button == 'r' || button == 'R' || 615 } else if (button == 'r' || button == 'R' ||
612 button == '\x12' || button == '\x19') { 616 button == '\x12' || button == '\x19' ||
617 button == UI_REDO) {
613 midend_stop_anim(me); 618 midend_stop_anim(me);
614 if (!midend_redo(me)) 619 if (!midend_redo(me))
615 goto done; 620 goto done;
616 } else if (button == '\x13' && me->ourgame->can_solve) { 621 } else if ((button == '\x13' || button == UI_SOLVE) &&
622 me->ourgame->can_solve) {
617 if (midend_solve(me)) 623 if (midend_solve(me))
618 goto done; 624 goto done;
619 } else if (button == 'q' || button == 'Q' || button == '\x11') { 625 } else if (button == 'q' || button == 'Q' || button == '\x11' ||
626 button == UI_QUIT) {
620 ret = 0; 627 ret = 0;
621 goto done; 628 goto done;
622 } else 629 } else
@@ -2059,6 +2066,8 @@ char *midend_deserialise(midend *me,
2059 me->ourgame->new_drawstate(me->drawing, 2066 me->ourgame->new_drawstate(me->drawing,
2060 me->states[me->statepos-1].state); 2067 me->states[me->statepos-1].state);
2061 midend_size_new_drawstate(me); 2068 midend_size_new_drawstate(me);
2069 if (me->game_id_change_notify_function)
2070 me->game_id_change_notify_function(me->game_id_change_notify_ctx);
2062 2071
2063 ret = NULL; /* success! */ 2072 ret = NULL; /* success! */
2064 2073