changes from Alessandro Scotti from 20051129
[xboard.git] / gamelist.c
index 0df36b6..e8d4132 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * gamelist.c -- Functions to manage a gamelist
- * XBoard $Id$
+ * XBoard $Id: gamelist.c,v 2.1 2003/10/27 19:21:00 mann Exp $
  *
  * Copyright 1995 Free Software Foundation, Inc.
  *
@@ -157,9 +157,9 @@ int GameListBuild(f)
     gameNumber = 0;
 
     lastStart = (ChessMove) 0;
-    yyskipmoves = TRUE;
+    yyskipmoves = FALSE;
     do {
-       yyboardindex = 1;
+        yyboardindex = 0;
        offset = yyoffset();
        cm = (ChessMove) yylex();
        switch (cm) {
@@ -222,6 +222,20 @@ int GameListBuild(f)
                }
            } while (cm == PGNTag || cm == Comment);
            break;
+         case NormalMove:
+           /* Allow the first game to start with an unnumbered move */
+           yyskipmoves = TRUE;
+           if (lastStart == (ChessMove) 0) {
+             if ((error = GameListNewGame(&currentListGame))) {
+               rewind(f);
+               yyskipmoves = FALSE;
+               return(error);
+             }
+             currentListGame->number = ++gameNumber;
+             currentListGame->offset = offset;
+             lastStart = MoveNumberOne;
+           }
+           break;
          default:
            break;
        }