From: Laurent Mazet Date: Thu, 30 May 2024 22:01:15 +0000 (+0200) Subject: alternativ key set X-Git-Tag: v1.0~13 X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=6fa74be022256677d4185491a88dc4f0286adab4;p=bs.git alternativ key set --- 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;