]> granicus.if.org Git - nethack/commitdiff
Missed couple direction enum places
authorPasi Kallinen <paxed@alt.org>
Mon, 28 Jun 2021 14:41:04 +0000 (17:41 +0300)
committerPasi Kallinen <paxed@alt.org>
Mon, 28 Jun 2021 14:41:04 +0000 (17:41 +0300)
src/cmd.c

index 23e69b47993c7c5239c8342e556a85ef650aa46e..5b5cd9d4592ef8acb8d434d1a6e22490d6102baa 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -3186,7 +3186,7 @@ reset_commands(boolean initial)
     static const int ylist[] = {
         'y', 'Y', C('y'), M('y'), M('Y'), M(C('y'))
     };
-    static struct ext_func_tab *back_dir_cmd[8];
+    static struct ext_func_tab *back_dir_cmd[N_DIRS];
     static boolean backed_dir_cmd = FALSE;
     const struct ext_func_tab *cmdtmp;
     boolean flagtemp;
@@ -3201,7 +3201,7 @@ reset_commands(boolean initial)
         commands_init();
     } else {
         if (backed_dir_cmd) {
-            for (i = 0; i < 8; i++) {
+            for (i = 0; i < N_DIRS; i++) {
                 g.Cmd.commands[(uchar) g.Cmd.dirchars[i]] = back_dir_cmd[i];
             }
         }
@@ -3278,14 +3278,14 @@ reset_commands(boolean initial)
         g.Cmd.move[i] = g.Cmd.dirchars[i];
 
     if (!initial) {
-        for (i = 0; i < 8; i++) {
+        for (i = 0; i < N_DIRS; i++) {
             uchar di = (uchar) g.Cmd.dirchars[i];
 
             back_dir_cmd[i] = (struct ext_func_tab *) g.Cmd.commands[di];
             g.Cmd.commands[di] = (struct ext_func_tab *) 0;
         }
         backed_dir_cmd = TRUE;
-        for (i = 0; i < 8; i++)
+        for (i = 0; i < N_DIRS; i++)
             (void) bind_key(g.Cmd.dirchars[i], "nothing");
     }
 }
@@ -3353,7 +3353,7 @@ randomkey(void)
     case 10:
     case 11:
     case 12:
-        c = g.Cmd.dirchars[rn2(8)];
+        c = g.Cmd.dirchars[rn2(N_DIRS)];
         if (!rn2(7))
             c = !g.Cmd.num_pad ? (!rn2(3) ? C(c) : (c + 'A' - 'a')) : M(c);
         break;