Ensure the player names are refreshed after a switch (impacts Curses mode).
[gnushogi.git] / gnushogi / commondsp.c
index 17a639a..33d1068 100644 (file)
@@ -6,6 +6,7 @@
  * ----------------------------------------------------------------------
  * Copyright (c) 1993, 1994, 1995 Matthias Mutz
  * Copyright (c) 1999 Michael Vanier and the Free Software Foundation
+ * Copyright (c) 2008, 2013, 2014 Yann Dirson and the Free Software Foundation
  *
  * GNU SHOGI is based on GNU CHESS
  *
  *
  */
 
+/* request *snprintf prototypes */
+#define _POSIX_C_SOURCE 200112L
+#include <stdio.h>
+
 #if defined HAVE_GETTIMEOFDAY
 #include <sys/time.h>
 #endif
@@ -372,17 +377,17 @@ parser(char *f, int side, short *fpiece)
 
     if (f[1] == '*' || f[1] == '\'')
     {
-        c2 = COL_NAME(f[2]);
-        r2 = ROW_NAME(f[3]);
+        c2 = COL_NUM(f[2]);
+        r2 = ROW_NUM(f[3]);
 
         return ((NO_SQUARES + *fpiece) << 8) | locn(r2, c2);
     }
     else
     {
-        c1 = COL_NAME(f[1]);
-        r1 = ROW_NAME(f[2]);
-        c2 = COL_NAME(f[3]);
-        r2 = ROW_NAME(f[4]);
+        c1 = COL_NUM(f[1]);
+        r1 = ROW_NUM(f[2]);
+        c2 = COL_NUM(f[3]);
+        r2 = ROW_NUM(f[4]);
         p = (f[5] == '+') ? 0x80 : 0;
 
         return (locn(r1, c1) << 8) | locn(r2, c2) | p;
@@ -542,10 +547,12 @@ GetGame(void)
             skipb();
             Captured[side][pawn] = atoi(InPtr);
             skip();
+#ifndef MINISHOGI
             Captured[side][lance] = atoi(InPtr);
             skip();
             Captured[side][knight] = atoi(InPtr);
             skip();
+#endif
             Captured[side][silver] = atoi(InPtr);
             skip();
             Captured[side][gold] = atoi(InPtr);
@@ -710,16 +717,24 @@ SaveGame(void)
         }
 
         fputs(empty, fd);
-        fprintf(fd, "   9 8 7 6 5 4 3 2 1\n");    /* FIXME */
+#ifndef MINISHOGI
+        fprintf(fd, "   9 8 7 6 5 4 3 2 1\n");
         fputs(empty, fd);
         fprintf(fd, "   p  l  n  s  g  b  r  k\n");
+#else
+        fprintf(fd, "   5 4 3 2 1\n");
+        fputs(empty, fd);
+        fprintf(fd, "   p  s  g  b  r  k\n");
+#endif
 
         for (side = 0; side <= 1; side++)
         {
             fprintf(fd, "%c", (side == black) ? 'B' : 'W');
             fprintf(fd, " %2d", Captured[side][pawn]);
+#ifndef MINISHOGI
             fprintf(fd, " %2d", Captured[side][lance]);
             fprintf(fd, " %2d", Captured[side][knight]);
+#endif
             fprintf(fd, " %2d", Captured[side][silver]);
             fprintf(fd, " %2d", Captured[side][gold]);
             fprintf(fd, " %2d", Captured[side][bishop]);
@@ -871,10 +886,12 @@ GetXGame(void)
             InPtr = fname;
             Captured[side][pawn]   = atoi(InPtr);
             skip();
+#ifndef MINISHOGI
             Captured[side][lance]  = atoi(InPtr);
             skip();
             Captured[side][knight] = atoi(InPtr);
             skip();
+#endif
             Captured[side][silver] = atoi(InPtr);
             skip();
             Captured[side][gold]   = atoi(InPtr);
@@ -955,10 +972,17 @@ SaveXGame(void)
 
         for (side = 0; side <= 1; side++)
         {
-            sprintf(fname, "%d %d %d %d %d %d %d %d\n",
+            sprintf(fname,
+#ifndef MINISHOGI
+                   "%d %d %d %d %d %d %d %d\n",
+#else
+                   "%d %d %d %d %d %d\n",
+#endif
                     Captured[side][pawn],
+#ifndef MINISHOGI
                     Captured[side][lance],
                     Captured[side][knight],
+#endif
                     Captured[side][silver],
                     Captured[side][gold],
                     Captured[side][bishop],
@@ -1788,6 +1812,7 @@ InputCommand(char *command)
             flag.force = false;
             Sdepth = 0;
             ok = true;
+            UpdateDisplay(0, 0, 1, 0);
         }
         else if (strcmp(s, "black") == 0)
         {