From: H.G.Muller Date: Sun, 15 Feb 2015 22:12:14 +0000 (+0100) Subject: Fix promotion sweep of black Pawns in Shogi X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=2fbce24cf46beda8a9049be879d5b82981ddf82d;p=xboard.git Fix promotion sweep of black Pawns in Shogi The wrap-around when we run past white King should not be done in toggle mode, where it is guaranteed we won't run out of range. --- diff --git a/backend.c b/backend.c index 5b66016..4974fed 100644 --- a/backend.c +++ b/backend.c @@ -5399,8 +5399,8 @@ Sweep (int step) if(step && !(toggleFlag && Partner(&promoSweep))) promoSweep -= step; if(promoSweep == EmptySquare) promoSweep = BlackPawn; // wrap else if((int)promoSweep == -1) promoSweep = WhiteKing; - else if(promoSweep == BlackPawn && step < 0) promoSweep = WhitePawn; - else if(promoSweep == WhiteKing && step > 0) promoSweep = BlackKing; + else if(promoSweep == BlackPawn && step < 0 && !toggleFlag) promoSweep = WhitePawn; + else if(promoSweep == WhiteKing && step > 0 && !toggleFlag) promoSweep = BlackKing; if(!step) step = -1; } while(PieceToChar(promoSweep) == '.' || PieceToChar(promoSweep) == '~' || promoSweep == pawn || !toggleFlag && PieceToChar(promoSweep) == '+' || // skip promoted versions of other