From 72fa46586658fa5a7e797e66167583b17cb5a858 Mon Sep 17 00:00:00 2001 From: kcwu Date: Mon, 8 Aug 2005 14:00:40 +0000 Subject: fix chess internal coordinate. !! NOTE !!, not compatible with older revision. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3009 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- include/chc.h | 5 +++-- include/chess.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/chc.h b/include/chc.h index 31aa49bc..eb1bae83 100644 --- a/include/chc.h +++ b/include/chc.h @@ -32,9 +32,10 @@ #define CHE_O(c) ((c) >> 3) #define CHE_P(c) ((c) & 7) -#define RTL(x) (((x) - 3) >> 1) +#define RTL(myturn, x) ((myturn)==BLK?BRD_ROW-1-((x)-3)/2:((x)-3)/2) +#define CTL(myturn, x) ((myturn)==BLK?BRD_COL-1-(x):(x)) #define dim(x) (sizeof(x) / sizeof(x[0])) -#define LTR(x) ((x) * 2 + 3) +#define LTR(myturn, x) ((((myturn)==BLK?BRD_ROW-1-(x):(x)) * 2) + 3) #define CHE(a, b) ((a) | ((b) << 3)) #define BLACK_COLOR ANSI_COLOR(1;36) diff --git a/include/chess.h b/include/chess.h index 82b72a6e..766486aa 100644 --- a/include/chess.h +++ b/include/chess.h @@ -86,7 +86,7 @@ typedef struct ChessInfo { const ChessGameMode mode; const ChessUser user1; const ChessUser user2; - const char my; /* 我方顏色 */ + const char myturn; /* 我方顏色 */ char turn; char ipass, hepass; @@ -113,7 +113,7 @@ typedef struct ChessInfo { typedef struct ChessActions { /* initial */ void (*init_user) (const userec_t* rec, ChessUser* user); - void (*init_board) (const ChessInfo* info, void* board); + void (*init_board) (void* board); /* playing */ void (*drawline) (const ChessInfo* info, int line); -- cgit v1.2.3