Always accept piece commands for Falcon and Cobra
[xboard.git] / moves.c
diff --git a/moves.c b/moves.c
index 015f5f2..e1b0145 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -276,8 +276,8 @@ MovesFromString (Board board, int flags, int f, int r, char *desc, MoveCallback
                    while(islower(*desc) && (i = dirType[*desc-'a']) != '0') {
                        int b = dirs2[*desc-'a']; // when alone, use narrow version
                        if(desc[1] == 'h') b = dirs1[*desc-'a'], desc += 2; // dirs1 is wide version
-                       else if(islower(desc[1]) && i < '4'
-                               && ((i | dirType[desc[1]-'a']) & 3) == 3) { // combinable (perpendicular dim)
+                       else if(*desc == desc[1] || islower(desc[1]) && i < '4'
+                               && ((i | dirType[desc[1]-'a']) & 3) == 3) { // combinable (perpendicular dim or same)
                            b = dirs1[*desc-'a'] & dirs2[desc[1]-'a'];      // intersect wide & perp narrow
                            desc += 2;
                        } else desc++;
@@ -1663,7 +1663,7 @@ LegalityTest (Board board, int flags, int rf, int ff, int rt, int ft, int promoC
     /* [HGM] Cobra and Falcon are wildcard pieces; consider all their moves legal */
     /* (perhaps we should disallow moves that obviously leave us in check?)              */
     if((piece == WhiteFalcon || piece == BlackFalcon ||
-        piece == WhiteCobra  || piece == BlackCobra) && gameInfo.variant != VariantChu)
+        piece == WhiteCobra  || piece == BlackCobra) && gameInfo.variant != VariantChu && !pieceDesc[piece])
         return CheckTest(board, flags, rf, ff, rt, ft, FALSE) ? IllegalMove : NormalMove;
 
     cl.rf = rf;