From: H.G.Muller Date: Wed, 24 Sep 2014 17:43:27 +0000 (+0200) Subject: Implement Betza o modifier for cylinder boards X-Git-Url: http://hgm.nubati.net/cgi-bin/gitweb.cgi?p=xboard.git;a=commitdiff_plain;h=375e33f3342eca6f274a58d21c147f65a29b70ca;ds=sidebyside Implement Betza o modifier for cylinder boards --- diff --git a/moves.c b/moves.c index 48310460..a3eebcca 100644 --- a/moves.c +++ b/moves.c @@ -250,6 +250,7 @@ MovesFromString (Board board, int flags, int f, int r, char *desc, MoveCallback if(!mode) mode = his + 4;// no mode spec, use default = mc if(*desc == 'p') mode |= 32, desc++; if(*desc == 'g') mode |= 64, desc++; + if(*desc == 'o') mode |= 128, desc++; if(*desc == 'n') jump = 0, desc++; while(*desc == 'j') jump++, desc++; dx = xStep[*p-'A'] - '0'; // step vector of atom @@ -272,7 +273,9 @@ MovesFromString (Board board, int flags, int f, int r, char *desc, MoveCallback x = f; y = r; // start square do { x += vx; y += vy; // step to next square - if(y < 0 || y >= BOARD_HEIGHT || x < BOARD_LEFT || x >= BOARD_RGHT) break; + if(y < 0 || y >= BOARD_HEIGHT) break; // vertically off-board: always done + if(x < BOARD_LEFT) { if(mode & 128) x += BOARD_RGHT - BOARD_LEFT; else break; } + if(x >= BOARD_RGHT) { if(mode & 128) x -= BOARD_RGHT - BOARD_LEFT; else break; } if(!jump && board[y - vy + vy/2][x - vx + vx/2] != EmptySquare) break; // blocked if(jump > 1 && board[y - vy + vy/2][x - vx + vx/2] == EmptySquare) break; // no hop if(board[y][x] < BlackPawn) occup = 1; else