From c239df0067fc40c49d83a187ae45cd52573a8459 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 26 Nov 2015 22:12:22 +0100 Subject: [PATCH] Fix piece commands for suffixed piece IDs Due to signed-/unsigned-char problems piece IDs suffixed with ' or ! would not be recognized. In addition a & behind it would not be correctly recognized diue to the alignment problem the suffix character caused. Both issues are fixed now. --- backend.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend.c b/backend.c index bd37f6d..95ab011 100644 --- a/backend.c +++ b/backend.c @@ -8983,7 +8983,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h char *p=buf2, *q, *s = SUFFIXES, ID = *p; if(*p == '+') piece = CHUPROMOTED WhitePawn, ID = *++p; if(q = strchr(s, p[1])) ID += 64*(q - s + 1), p++; - piece += CharToPiece(ID) - WhitePawn; + piece += CharToPiece(ID & 255) - WhitePawn; if(cps != &first || appData.testLegality && *engineVariant == NULLCHAR /* always accept definition of */ && piece != WhiteFalcon && piece != BlackFalcon /* wild-card pieces. */ && piece != WhiteCobra && piece != BlackCobra @@ -8995,7 +8995,7 @@ FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book h if(piece < EmptySquare) { pieceDefs = TRUE; ASSIGN(pieceDesc[piece], buf1); - if(isupper(*p) && p[1] == '&') { ASSIGN(pieceDesc[WHITE_TO_BLACK piece], buf1); } + if((ID & 32) == 0 && p[1] == '&') { ASSIGN(pieceDesc[WHITE_TO_BLACK piece], buf1); } } return; } -- 1.7.0.4