XBoard: make messages compatible with xboard protocol.
authorH.G. Muller <h.g.muller@hccnet.nl>
Tue, 15 Oct 2013 19:44:39 +0000 (21:44 +0200)
committerYann Dirson <ydirson@free.fr>
Mon, 17 Feb 2014 22:04:16 +0000 (23:04 +0100)
Introduces the "xboard" global var, but only yhe last commit will set
it, when support is complete.

Some non-compliant utterances had to be disarmed by commenting them
out with a leading '#'.

YD: split original patch into a series

gnushogi/book.c
gnushogi/commondsp.c
gnushogi/gnushogi.h
gnushogi/rawdsp.c

index 6bf2af9..79f9b4c 100644 (file)
@@ -293,7 +293,7 @@ BVerifyMove(char *s, unsigned short *mv, int moveno)
             UnmakeMove(opponent, &xnode, &tempb, &tempc, &tempsf, &tempst);
             /* Illegal move in check */
 #if !defined QUIETBOOKGEN
-            puts("Illegal move (in check) %s");
+            puts("Illegal move (in check): %s");
             bkdisplay(s, cnt, moveno);
 #endif
             return false;
@@ -313,7 +313,7 @@ BVerifyMove(char *s, unsigned short *mv, int moveno)
 
     /* Illegal move */
 #if !defined QUIETBOOKGEN
-    printf("Illegal move (no match) %s\n", s);
+    printf("Illegal move (no match): %s\n", s);
     bkdisplay(s, cnt, moveno);
 #endif
     return false;
index e5efc17..7361e76 100644 (file)
@@ -54,6 +54,7 @@ int mycnt1, mycnt2;
 static char *InPtr;
 struct display *dsp = &raw_display;
 
+short xboard = false;
 
 #if defined(BOOKTEST)
 
@@ -310,7 +311,7 @@ VerifyMove(char *s, VerifyMove_mode iop, unsigned short *mv)
         if (SqAttacked(PieceList[opponent][0], computer, &blocked))
         {
             UnmakeMove(opponent, &xnode, &tempb, &tempc, &tempsf, &tempst);
-            dsp->AlwaysShowMessage("Illegal move (in check) %s", s);
+            dsp->AlwaysShowMessage("Illegal move (in check): %s", s);
             return false;
         }
         else
@@ -352,7 +353,7 @@ VerifyMove(char *s, VerifyMove_mode iop, unsigned short *mv)
         }
     }
 
-    dsp->AlwaysShowMessage("Illegal move (no match) %s", s);
+    dsp->AlwaysShowMessage("Illegal move (no match): %s", s);
 
     if (!XSHOGI && (cnt > 1))
     {
index 7854113..322d32f 100644 (file)
@@ -66,6 +66,7 @@ extern display_t display_type;
 
 extern short hard_time_limit; /* If you exceed time limit, you lose.   */
 extern short nolist;          /* Don't list game after exit.           */
+extern short xboard;          /* Use XBoard instead of xShogi protocol */
 
 
 /*
index 588f13f..1a1035b 100644 (file)
@@ -177,7 +177,7 @@ static void
 Raw_ShowPatternCount(short side, short n)
 {
     if (flag.post)
-        printf("%s matches %d pattern(s)\n", ColorStr[side], n);
+        printf("%s%s matches %d pattern(s)\n", xboard ? "# " : "" , ColorStr[side], n);
 }
 
 
@@ -578,10 +578,10 @@ Raw_OutputMove(void)
         printf("%s mates!\n", ColorStr[computer]);
 #ifdef VERYBUGGY
     else if (!XSHOGI && (root->score < -SCORE_LIMIT))
-        printf("%s has a forced mate in %d moves!\n",
+        printf("%s%s has a forced mate in %d moves!\n", xboard ? "# " : "",
                ColorStr[opponent], SCORE_LIMIT + 999 + root->score - 1);
     else if (!XSHOGI && (root->score > SCORE_LIMIT))
-        printf("%s has a forced mate in %d moves!\n",
+        printf("%s%s has a forced mate in %d moves!\n", xboard ? "# " : "",
                ColorStr[computer], SCORE_LIMIT + 998 - root->score - 1);
 #endif /* VERYBUGGY */
 }