{ "ub", ArgBoolean, (void *) &appData.useBorder, FALSE, INVALID },
{ "border", ArgFilename, (void *) &appData.border, TRUE, (ArgIniType) "" },
{ "finger", ArgFilename, (void *) &appData.finger, FALSE, (ArgIniType) "" },
+ { "inscriptions", ArgString, (void *) &appData.inscriptions, XBOARD, (ArgIniType) "" },
// [HGM] tournament options
{ "tourneyFile", ArgFilename, (void *) &appData.tourneyFile, FALSE, (ArgIniType) "" },
}
/* [AS] Adjudicate game if needed (note: remember that forwardMostMove now points past the last move) */
- if( gameMode == TwoMachinesPlay && adjudicateLossThreshold != 0 && forwardMostMove >= adjudicateLossPlies ) {
+ if( gameMode == TwoMachinesPlay && appData.adjudicateLossThreshold != 0 && forwardMostMove >= adjudicateLossPlies ) {
int count = 0;
while( count < adjudicateLossPlies ) {
if( count & 1 ) {
score = -score; /* Flip score for winning side */
}
-
- if( score > adjudicateLossThreshold ) {
+printf("score=%d count=%d\n",score,count);
+ if( score > appData.adjudicateLossThreshold ) {
break;
}
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
- cairo_set_font_size (cr, squareSize/4);
+ cairo_set_font_size (cr, align < 0 ? 2*squareSize/3 : squareSize/4);
// calculate where it goes
cairo_text_extents (cr, string, &te);
yy += -te.y_bearing + 3;
} else if (align == 4) {
xx += te.x_bearing + 1, yy += -te.y_bearing + 3;
+ } else if (align < 0) {
+ xx += squareSize/2 - te.width/2, yy += 9*squareSize/16 - te.y_bearing/2;
}
cairo_move_to (cr, xx-1, yy);
}
void
+InscribeKanji (ChessSquare piece, int x, int y)
+{
+ char *p, *q, buf[10];
+ int n;
+ if(piece == EmptySquare) return;
+ if(piece >= BlackPawn) piece = BLACK_TO_WHITE piece;
+ p = appData.inscriptions;
+ n = piece;
+ while(piece > WhitePawn) {
+ if(*p++ == NULLCHAR) {
+ if(n != WhiteKing) return;
+ p = q;
+ break;
+ }
+ q = p - 1;
+ while((*p & 0xC0) == 0x80) p++; // skip UTF-8 continuation bytes
+ piece--;
+ }
+ strncpy(buf, p, 10);
+ for(q=buf; (*++q & 0xC0) == 0x80;);
+ *q = NULLCHAR;
+ DrawText(buf, x, y, -1);
+}
+
+void
DrawOneSquare (int x, int y, ChessSquare piece, int square_color, int marker, char *tString, char *bString, int align)
{ // basic front-end board-draw function: takes care of everything that can be in square:
// piece, background, coordinate/count, marker dot
BlankSquare(csBoardWindow, x, y, square_color, piece, 1);
} else {
pngDrawPiece(csBoardWindow, piece, square_color, x, y);
+ InscribeKanji(piece, x, y);
}
if(align) { // square carries inscription (coord or piece count)