Let t on final leg in Betza notation forbid checking
[xboard.git] / moves.c
diff --git a/moves.c b/moves.c
index d1b6508..ad700e8 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -300,6 +300,9 @@ MovesFromString (Board board, int flags, int f, int r, int tx, int ty, int angle
                    break;
          case 'N': all = 0xFF;  // oblique atom (degenerate 8-fold)
                    if(tx >= 0) goto king;        // continuation legs specified in K/Q system!
+                   if(*desc == 'h') {            // chiral direction sets 'hr' and 'hl'
+                       dirSet = (desc[1] == 'r' ? 0x55 :  0xAA); desc += 2;
+                   } else
                    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
@@ -359,7 +362,7 @@ MovesFromString (Board board, int flags, int f, int r, int tx, int ty, int angle
            mode |= 1024; dy = 1;
        }
         if(!cont) {
-           if(!(mode & 15)) mode = his + 4;          // no mode spec, use default = mc
+           if(!(mode & 15)) mode |= his + 4;         // no mode spec, use default = mc
        } else {
            strncpy(buf, cont, 80); cont = buf;       // copy next leg(s), so we can modify
            atom = buf; while(islower(*atom)) atom++; // skip to atom
@@ -371,7 +374,7 @@ MovesFromString (Board board, int flags, int f, int r, int tx, int ty, int angle
                atom[1] = atom[2] = '\0';             // make sure any old range is stripped off
                if(expo == 1) atom[1] = '0';          // turn other leapers into riders 
            }
-           if(!(mode & 0x30F)) mode = 4;             // and default of this leg = m
+           if(!(mode & 0x30F)) mode |= 4;            // and default of this leg = m
        }
        if(dy == 1) skip = jump - 1, jump = 1;        // on W & F atoms 'j' = skip first square
         do {
@@ -430,6 +433,7 @@ MovesFromString (Board board, int flags, int f, int r, int tx, int ty, int angle
                        cb(board, flags, mine == 1 ? WhiteKingSideCastle : BlackKingSideCastle, r, f, y, f + expo, cl);
                    break;
                }
+               if(mode & 16 && (board[y][x] == WhiteKing || board[y][x] == BlackKing)) break; // tame piece, cannot capture royal
                if(occup & mode) cb(board, flags, NormalMove, r, f, y, x, cl);    // allowed, generate
                if(occup != 4) break; // not valid transit square
            } while(--i);