Curses: parametrize hardcoded values for captures pieces, fixing minishogi display.
[gnushogi.git] / gnushogi / cursesdsp.c
index 2fa6d4c..d2b336b 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))
@@ -446,8 +446,8 @@ Curses_help(void)
 }
 
 
-static const short x0[2] = { 54, 2 };
-static const short y0[2] = { 20, 4 };
+static const short x0[2] = { MARGIN + 5*NO_COLS + 4, 2 };
+static const short y0[2] = { 4 + 2 * (NO_ROWS - 1), 4 };
 
 
 /*
@@ -485,6 +485,7 @@ Curses_EditBoard(void)
         ClearEoln();
         FLUSH_SCANW("%s", s);
         found = 0;
+        ClearMessage();
 
         if (s[0] == '.')
             break;
@@ -520,15 +521,18 @@ 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);
 
@@ -547,6 +551,9 @@ Curses_EditBoard(void)
             }
         }
 
+        if (!found)
+            AlwaysShowMessage("Invalid piece type '%c'", s[0]);
+
         DrawPiece(sq);
     }