Definition of TimeMark moved from 3 c files to backend.h
[xboard.git] / gamelist.c
index fb10fbe..9cb3a58 100644 (file)
@@ -217,10 +217,9 @@ int GameListBuild(f)
     int error, scratch=100, plyNr=0, fromX, fromY, toX, toY;
     int offset;
     char lastComment[MSG_SIZ], buf[MSG_SIZ];
-struct {
-    long sec;  /* Assuming this is >= 32 bits */
-    int ms;    /* Assuming this is >= 16 bits */
-} t,t2; GetTimeMark(&t);
+    TimeMark t, t2;
+
+    GetTimeMark(&t);
     GameListFree(&gameList);
     yynewfile(f);
     gameNumber = 0;
@@ -342,7 +341,7 @@ struct {
                toY = currentMoveString[3] - ONE;
                plyNr++;
                ApplyMove(fromX, fromY, toX, toY, currentMoveString[4], boards[scratch]);
-               if(currentListGame->moves) PackMove(fromX, fromY, toX, toY, boards[scratch][toY][toX]);
+               if(currentListGame && currentListGame->moves) PackMove(fromX, fromY, toX, toY, boards[scratch][toY][toX]);
            break;
         case WhiteWins: // [HGM] rescom: save last comment as result details
         case BlackWins:
@@ -368,6 +367,7 @@ struct {
     }
     while (cm != (ChessMove) 0);
 
+ if(currentListGame) {
     if(!currentListGame->moves) DisplayError("Game cache overflowed\nPosition-searching might not work properly", 0);
 
     if (appData.debugMode) {
@@ -380,6 +380,7 @@ struct {
            PrintPGNTags(debugFP, &currentListGame->gameInfo);
        }
     }
+  }
 GetTimeMark(&t2);printf("GameListBuild %d msec\n", SubtractTimeMarks(&t2,&t));
     quickFlag = 0;
     PackGame(boards[scratch]); // for appending end-of-game marker.