diff --git a/applications/fpchess/chessgame.pas b/applications/fpchess/chessgame.pas index 30399da66..84563df85 100644 --- a/applications/fpchess/chessgame.pas +++ b/applications/fpchess/chessgame.pas @@ -114,6 +114,7 @@ type procedure StartNewGame(APlayAsWhite: Integer; AUseTimer: Boolean; APlayerTime: Integer); overload; function ClientToBoardCoords(AClientCoords: TPoint): TPoint; function BoardPosToChessCoords(APos: TPoint): string; + function ColumnNumToLetter(ACol: Integer): string; function CheckStartMove(AFrom: TPoint): Boolean; function CheckEndMove(ATo: TPoint): Boolean; function FindKing(): TPoint; @@ -722,10 +723,15 @@ function TChessGame.BoardPosToChessCoords(APos: TPoint): string; var lStr: string; begin - lStr := Char(APos.X + 96); + lStr := ColumnNumToLetter(APos.X); Result := Format('%s%d', [lStr, APos.Y]); end; +function TChessGame.ColumnNumToLetter(ACol: Integer): string; +begin + Result := Char(ACol + 96); +end; + // Check if we are moving to either an empty space or to an enemy piece function TChessGame.CheckEndMove(ATo: TPoint): Boolean; begin diff --git a/applications/fpchess/mainform.pas b/applications/fpchess/mainform.pas index 0a0ebb06e..88a587904 100644 --- a/applications/fpchess/mainform.pas +++ b/applications/fpchess/mainform.pas @@ -143,13 +143,14 @@ end; procedure TformChess.UpdateCaptions; var - lStr: string; + lStr, lStr2: string; begin if vChessGame.IsWhitePlayerTurn then lStr := 'White playing' else lStr := 'Black playing'; - lStr := lStr + Format(' X: %d Y: %d', - [vChessGame.MouseMovePos.X, vChessGame.MouseMovePos.Y]); + lStr2 := vChessGame.BoardPosToChessCoords(vChessGame.MouseMovePos); + lStr := lStr + Format(' X: %d Y: %d = %s', + [vChessGame.MouseMovePos.X, vChessGame.MouseMovePos.Y, lStr2]); formChess.labelPos.Caption := lStr;