EditBoard: display message on wrong input.
[gnushogi.git] / gnushogi / rawdsp.c
index 2c4d185..53d051c 100644 (file)
@@ -385,6 +385,8 @@ Raw_EditBoard(void)
                     break;
                 }
             }
+            if (!found)
+                printf("# Invalid piece type '%c'\n", s[0]);
             continue;
         }
 
@@ -392,17 +394,17 @@ Raw_EditBoard(void)
         r = ROW_NUM(s[2]);
 
         if ((c < 0) || (c >= NO_COLS) || (r < 0) || (r >= NO_ROWS)) {
+            printf("# Out-of-board position '%c%c'\n", s[1], s[2]);
             continue;
         }
 
         sq = locn(r, c);
-        color[sq] = a;
-        board[sq] = no_piece;
 
         for (i = no_piece; i <= king; i++)
         {
             if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
             {
+                color[sq] = a;
                 if (s[3] == '+')
                     board[sq] = promoted[i];
                 else
@@ -413,8 +415,8 @@ Raw_EditBoard(void)
             }
         }
 
-        if (found == 0)
-            color[sq] = neutral;
+        if (!found)
+            printf("# Invalid piece type '%c'\n", s[0]);
     }
 
     for (sq = 0; sq < NO_SQUARES; sq++)