src/game.c

changeset 114
12df1b7c792f
parent 113
5f58df30d422
--- a/src/game.c	Mon Apr 27 16:55:28 2026 +0200
+++ b/src/game.c	Mon Apr 27 18:06:00 2026 +0200
@@ -274,6 +274,7 @@
     char movestr[MOVESTR_BUFLEN];
     bool remis_rejected = false;
     bool remis_suggested = false;
+    bool resign_suggested = false;
     bool use_premove = false;
     uint8_t code;
 
@@ -294,12 +295,18 @@
         
         move(inputy, 0);
         printw("Use chess notation to enter your move.\n");
-        if (remis_suggested) {
-            printw("The opponent offers remis. Also type remis to accept.\n\n");
+        if (resign_suggested) {
+            if (remis_suggested) {
+                printw("The opponent asks you to resign or accept remis. \n\n");
+            } else {
+                printw("The opponent asks you to resign.                 \n\n");
+            }
+        } else if (remis_suggested) {
+            printw("The opponent offers remis. Type remis to accept. \n\n");
         } else if (remis_rejected) {
-            printw("Remis offer rejected.                                \n\n");
+            printw("Remis offer rejected.                            \n\n");
         } else {
-            printw("Or use a command: remis, resign, savepgn             \n\n");
+            printw("Or use a command: remis, resign, savepgn         \n\n");
         }
         printw("Type your move: ");
         clrtoeol();
@@ -310,6 +317,9 @@
             case NETCODE_REMIS:
                 remis_suggested = true;
                 break;
+            case NETCODE_TAUNT:
+                resign_suggested = true;
+                break;
             case NETCODE_RESIGN:
                 gamestate->resign = 1;
                 printw("\rYour opponent resigned!");
@@ -424,19 +434,25 @@
 
     size_t bufpos = 0;
     char movestr[MOVESTR_BUFLEN];
-    bool remis_suggested = false;
+    bool remis_suggested = false, resign_suggested = false;
     while (1) {
         timecontrol(gamestate, gameinfo);
         
         move(inputy, 0);
-        printw("Awaiting opponent move. Use chess notation to prepare a move.\n");
+        printw("Waiting for opponent. Use chess notation to prepare a move.\n");
         if (*gamestate->premove) {
-            printw("Current pre-move: %s                    \n\n",
+            printw("Current pre-move: %s                             \n\n",
                 gamestate->premove);
-        } else if (remis_suggested) {
-            printw("Suggested remis.                        \n\n");
+        } else if (remis_suggested && !resign_suggested) {
+            printw("Suggested remis.                                 \n\n");
+        } else if (resign_suggested) {
+            if (remis_suggested) {
+                printw("Suggested to resign or at least to accept remis. \n\n");
+            } else {
+                printw("Suggested to resign.                             \n\n");
+            }
         } else {
-            printw("Or use a command: remis, resign, savepgn\n\n");
+            printw("Or use a command: remis, resign, taunt, savepgn  \n\n");
         }
         printw("Prepare your next move: ");
         clrtoeol();
@@ -451,6 +467,9 @@
                 refresh();
                 net_send_code(opponent, NETCODE_RESIGN);
                 return 1;
+            } else if (strncmp(movestr, "taunt", MOVESTR_BUFLEN) == 0) {
+                resign_suggested = true;
+                net_send_code(opponent, NETCODE_TAUNT);
             } else if (strncmp(movestr, "remis", MOVESTR_BUFLEN) == 0) {
                 remis_suggested = true;
                 net_send_code(opponent, NETCODE_REMIS);

mercurial