From: H.G. Muller Date: Tue, 12 Mar 2013 17:50:08 +0000 (+0100) Subject: Fix horrible bug in reading scores from PGN X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6bb8c7c57851a7cf4ed99dea5023e747c9d2adb9;p=xboard.git Fix horrible bug in reading scores from PGN Reading scores like -0.94 flipped the sign, because the integer part -0 would read as 0, and thus was no reason for sign flipping. --- diff --git a/backend.c b/backend.c index f9995d9..618012f 100644 --- a/backend.c +++ b/backend.c @@ -15593,8 +15593,11 @@ GetInfoFromComment (int index, char * text) int time = -1, sec = 0, deci; char * s_eval = FindStr( text, "[%eval " ); char * s_emt = FindStr( text, "[%emt " ); - +#if 0 if( s_eval != NULL || s_emt != NULL ) { +#else + if(0) { // [HGM] this code is not finished, and could actually be detrimental +#endif /* New style */ char delim; @@ -15647,7 +15650,7 @@ GetInfoFromComment (int index, char * text) if(sec >= 0) time = 600*time + 10*sec; else if(deci >= 0) time = 10*time + deci; else time *= 10; // deci-sec - score = score >= 0 ? score*100 + score_lo : score*100 - score_lo; + score = score > 0 || !score & p[1] != '-' ? score*100 + score_lo : score*100 - score_lo; /* [HGM] PV time: now locate end of PV info */ while( *++sep >= '0' && *sep <= '9'); // strip depth