Curses: shift board one char to the right to leave enough space for captures.
[gnushogi.git] / gnushogi / cursesdsp.c
index 16125a0..98cec52 100644 (file)
@@ -64,7 +64,7 @@
 
 int mycnt1, mycnt2;
 
-#define MARGIN (4)
+#define MARGIN (5)
 #define TAB (58)
 
 #define VIR_C(s)  ((flag.reverse) ? (NO_COLS - 1 - column(s)) : column(s))
@@ -485,6 +485,7 @@ Curses_EditBoard(void)
         ClearEoln();
         FLUSH_SCANW("%s", s);
         found = 0;
+        ClearMessage();
 
         if (s[0] == '.')
             break;
@@ -520,24 +521,26 @@ Curses_EditBoard(void)
                     break;
                 }
             }
-
+            if (!found)
+                AlwaysShowMessage("Invalid piece type '%c'", s[0]);
             continue;
         }
 
         c = COL_NUM(s[1]);
         r = ROW_NUM(s[2]);
 
-        if ((c < 0) || (c >= NO_COLS) || (r < 0) || (r >= NO_ROWS))
+        if ((c < 0) || (c >= NO_COLS) || (r < 0) || (r >= NO_ROWS)) {
+            AlwaysShowMessage("Out-of-board '%c%c'", s[1], s[2]);
             continue;
+        }
 
         sq = locn(r, c);
-        color[sq] = a;
-        board[sq] = no_piece;
 
         for (i = NO_PIECES; i > no_piece; i--)
         {
             if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
             {
+                color[sq] = a;
                 if (s[3] == '+')
                     board[sq] = promoted[i];
                 else
@@ -548,9 +551,8 @@ Curses_EditBoard(void)
             }
         }
 
-
-        if (found == 0)
-            color[sq] = neutral;
+        if (!found)
+            AlwaysShowMessage("Invalid piece type '%c'", s[0]);
 
         DrawPiece(sq);
     }