alternativ key set
authorLaurent Mazet <mazet@softndesign.org>
Thu, 30 May 2024 22:01:15 +0000 (00:01 +0200)
committerLaurent Mazet <mazet@softndesign.org>
Thu, 30 May 2024 22:01:15 +0000 (00:01 +0200)
battleships.c

index 17f18ad94c6e415913408303e0d943426d9b2c51..18a1513fe811e397f72f733f92d3bb7544c8be14 100644 (file)
@@ -128,14 +128,7 @@ int main (int argc, char *argv[])
         }
         int c = getch ();
         switch (c) {
-        case KEY_ESC:
-#ifndef __PDCURSES__
-            if (getch () != KEY_ESC) {
-                break;
-            }
-#endif /* __PDCURSES__ */
-        case ':':
-            break;
+        case ' ':
         case 'd':
             if (length > 0) {
                 if (testlocation (boardhuman, length, x, y, orient ^ 1, " ")) {
@@ -191,6 +184,9 @@ int main (int argc, char *argv[])
                 }
             }
             break;
+        case KEY_ENTER:
+        case '\r':
+        case '\n':
         case 'p':
             if (length > 0) {
                 putlocation (boardhuman, length, x, y, orient, 'S');
@@ -218,9 +214,11 @@ int main (int argc, char *argv[])
                 /* computer turn */
             }
             break;
+        case KEY_ESC:
         case 'q':
             stop = 1;
             break;
+        case '\t':
         case 't':
             mode ^= 1;
             break;