From dd67211f46050409861a109a9778af6594279569 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 6 Feb 2013 10:56:20 +0100 Subject: [PATCH] Draw both coords in a1 The lower-left board square needed two inscriptions, but DrawOneSquare() only allowed one, so that the file ID would not be written. Now two strings can be passed, and when align > 1 to indicate the alignment of the top string, it is still checked if a bottom string is present as well, which then is drawn with alignment 1 (= bottom right). The rank coord or piece count can now also be double digit. --- board.c | 20 ++++++++++---------- board.h | 2 +- draw.c | 33 ++++++++++++++++++++------------- 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/board.c b/board.c index d5b4766..0becf9a 100644 --- a/board.c +++ b/board.c @@ -771,7 +771,7 @@ DrawDragPiece () it's being dragged around the board. So we erase the square that the piece is on and draw it at the last known drag point. */ DrawOneSquare(anims[Player].startSquare.x, anims[Player].startSquare.y, - EmptySquare, anims[Player].startColor, 0, NULL, 0); + EmptySquare, anims[Player].startColor, 0, NULL, NULL, 0); AnimationFrame(Player, &anims[Player].prevFrame, anims[Player].dragPiece); damage[0][anims[Player].startBoardY][anims[Player].startBoardX] = TRUE; } @@ -781,7 +781,7 @@ DrawSquare (int row, int column, ChessSquare piece, int do_flash) { int square_color, x, y, align=0; int i; - char string[2]; + char tString[3], bString[2]; int flash_delay; /* Calculate delay in milliseconds (2-delays per complete flash) */ @@ -799,37 +799,37 @@ DrawSquare (int row, int column, ChessSquare piece, int do_flash) square_color = SquareColor(row, column); - string[1] = NULLCHAR; + bString[1] = bString[0] = NULLCHAR; if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0) && column >= BOARD_LEFT && column < BOARD_RGHT) { - string[0] = 'a' + column - BOARD_LEFT; + bString[0] = 'a' + column - BOARD_LEFT; align = 1; // coord in lower-right corner } if (appData.showCoords && column == (flipView ? BOARD_RGHT-1 : BOARD_LEFT)) { - string[0] = ONE + row; + snprintf(tString, 3, "%d", ONE - '0' + row); align = 2; // coord in upper-left corner } if (column == (flipView ? BOARD_LEFT-1 : BOARD_RGHT) && piece > 1 ) { - string[0] = '0' + piece; + snprintf(tString, 3, "%d", piece); align = 3; // holdings count in upper-right corner } if (column == (flipView ? BOARD_RGHT : BOARD_LEFT-1) && piece > 1) { - string[0] = '0' + piece; + snprintf(tString, 3, "%d", piece); align = 4; // holdings count in upper-left corner } if(square_color == 2 || appData.blindfold) piece = EmptySquare; if (do_flash && piece != EmptySquare && appData.flashCount > 0) { for (i=0; i 1) DrawText(tString, x, y, align); // top (rank or count) + if(bString && *bString) DrawText(bString, x, y, 1); // bottom (always lower right file ID) } if(marker) { // print fat marker dot, if requested -- 1.7.0.4