Fix loading of engine-defined PGN games
authorH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 16 Oct 2014 19:44:33 +0000 (21:44 +0200)
committerArun Persaud <arun@nubati.net>
Fri, 17 Oct 2014 06:14:10 +0000 (23:14 -0700)
Somehow there could be disagreement over what the official opening
position of an engine-defined variant was during loading of the game.
It then refused Betza-defined castling, which tests the corner pieces
based on this initial position. We now assume the FEN tag, which such
a PGN game will always contain, holds the official opening position,
so that castling will always be assumed possible (if there is a corner
piece).

backend.c

index e50e869..bab4386 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -12877,6 +12877,8 @@ LoadGame (FILE *f, int gameNumber, char *title, int useList)
            return FALSE;
          }
          CopyBoard(boards[0], initial_position);
+         if(*engineVariant) // [HGM] for now, assume FEN in engine-defined variant game is default initial position
+           CopyBoard(initialPosition, initial_position);
          if (blackPlaysFirst) {
            currentMove = forwardMostMove = backwardMostMove = 1;
            CopyBoard(boards[1], initial_position);