tr = t / width;
tf = t % width;
move_s[0] = ff + 'a';
- move_s[1] = fr + '1' - (BOARD_HEIGHT > 9);
+ move_s[1] = fr + '1' - (BOARD_HEIGHT == 10);
move_s[2] = tf + 'a';
- move_s[3] = tr + '1' - (BOARD_HEIGHT > 9);
+ move_s[3] = tr + '1' - (BOARD_HEIGHT == 10);
if(IS_SHOGI(gameInfo.variant) && p) {
if(p == 2) p = 10; // Lion moves, for boards so big that 10 is out of range
return count;
}
+static int dirty;
+
int
ReadFromBookFile (int moveNr, char *book, entry_t entries[])
{ // retrieve all entries for given position from book in 'entries', return number.
static char curBook[MSG_SIZ];
if(book == NULL) return -1;
+ if(dirty) { if(f) fclose(f); dirty = 0; f = NULL; }
if(!f || strcmp(book, curBook)){ // keep book file open until book changed
strncpy(curBook, book, MSG_SIZ);
if(f) fclose(f);
writepos += len2;
} while(len1);
}
+ dirty = 1;
fclose(f);
}