From 6fa74be022256677d4185491a88dc4f0286adab4 Mon Sep 17 00:00:00 2001 From: Laurent Mazet Date: Fri, 31 May 2024 00:01:15 +0200 Subject: [PATCH] alternativ key set --- battleships.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/battleships.c b/battleships.c index 17f18ad..18a1513 100644 --- a/battleships.c +++ b/battleships.c @@ -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; -- 2.30.2