X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=286ec32cb436106e4017e4b35ba90d3b7dea0cce;hb=c75d2d23ecb6a2123ccf681852e9bef8c381ce22;hp=e235dc1710ba917393cc5a372b7f3c139779ea8c;hpb=e9959df8ffa2a11c47c4d385e797d2c27c0550a9;p=xboard.git diff --git a/backend.c b/backend.c index e235dc1..286ec32 100644 --- a/backend.c +++ b/backend.c @@ -11318,13 +11318,13 @@ int GameContainsPosition(FILE *f, ListGame *lg) if(lg->gameInfo.fen) ParseFEN(boards[scratch], &btm, lg->gameInfo.fen); else CopyBoard(boards[scratch], initialPosition); // default start position if(lg->moves && !QuickScan( boards[scratch], &moveDatabase[lg->moves] )) return -1; // quick scan rules out it is there - if(btm) CopyBoard(boards[scratch+1], boards[scratch]), plyNr++; - if(PositionMatches(boards[scratch + plyNr], boards[currentMove])) return plyNr; + if(btm) plyNr++; + if(PositionMatches(boards[scratch], boards[currentMove])) return plyNr; fseek(f, lg->offset, 0); yynewfile(f); while(1) { - yyboardindex = scratch + (plyNr&1); - quickFlag = 1; + yyboardindex = scratch; + quickFlag = plyNr+1; next = Myylex(); quickFlag = 0; switch(next) { @@ -11384,10 +11384,9 @@ int GameContainsPosition(FILE *f, ListGame *lg) break; } // Move encountered; peform it. We need to shuttle between two boards, as even/odd index determines side to move - CopyBoard(boards[scratch + (plyNr+1&1)], boards[scratch + (plyNr&1)]); plyNr++; - ApplyMove(fromX, fromY, toX, toY, promoChar, boards[scratch + (plyNr&1)]); - if(PositionMatches(boards[scratch + (plyNr&1)], boards[currentMove])) return plyNr; + ApplyMove(fromX, fromY, toX, toY, promoChar, boards[scratch]); + if(PositionMatches(boards[scratch], boards[currentMove])) return plyNr; } }