chiark / gitweb /
Reorder if statements in Unequal's interpret_move() so that presses
authorSimon Tatham <anakin@pobox.com>
Mon, 26 Jan 2009 22:28:17 +0000 (22:28 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 26 Jan 2009 22:28:17 +0000 (22:28 +0000)
of 'h' and 'm' are treated as digits if a square is selected, and
only treated as special commands otherwise. This renders very large
games (just about) playable.

Idea from Ben Hutchings's collection of Debian patches, although I
had to redo his (trivial) patch myself since the code has changed
recently.

(Addendum after committing: hmm, I see Jacob already applied the
original version of the patch a while back. Looks as if the recent
keyboard control change reintroduced the problem. Still, re-fixed
now.)

[originally from svn r8433]

unequal.c

index c9d2c602f3adfabd62a1644b9e8b824a7f0fbed4..26fcd418f6a86ab238a7345483294d38fa453dd1 100644 (file)
--- a/unequal.c
+++ b/unequal.c
@@ -1299,10 +1299,6 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
             return "";
         }
     }
-    if (button == 'H' || button == 'h')
-        return dupstr("H");
-    if (button == 'M' || button == 'm')
-        return dupstr("M");
 
     if (IS_CURSOR_MOVE(button)) {
         move_cursor(button, &ui->hx, &ui->hy, ds->order, ds->order, 0);
@@ -1340,6 +1336,12 @@ static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
 
         return dupstr(buf);
     }
+
+    if (button == 'H' || button == 'h')
+        return dupstr("H");
+    if (button == 'M' || button == 'm')
+        return dupstr("M");
+
     return NULL;
 }