diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-09-11 01:30:22 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-09-11 01:30:22 +0800 |
commit | f1c53390c4817e5f9552588f298808764ef1bc65 (patch) | |
tree | 6410c5100306d7aa816f796ad0f2865a76e64e8b /mbbsd/gomo.c | |
parent | 3a13adbea9793d58c961c3fc869fd1f79fdedad3 (diff) | |
download | pttbbs-f1c53390c4817e5f9552588f298808764ef1bc65.tar pttbbs-f1c53390c4817e5f9552588f298808764ef1bc65.tar.gz pttbbs-f1c53390c4817e5f9552588f298808764ef1bc65.tar.bz2 pttbbs-f1c53390c4817e5f9552588f298808764ef1bc65.tar.lz pttbbs-f1c53390c4817e5f9552588f298808764ef1bc65.tar.xz pttbbs-f1c53390c4817e5f9552588f298808764ef1bc65.tar.zst pttbbs-f1c53390c4817e5f9552588f298808764ef1bc65.zip |
GO convertion to chess framework
* versus, personal and watching all work
chess.c framework update
* "pass" and "tie request" are distinguished
* chess-specific key binding
* post-game processing
!!!NOTE!!! Chess protocals are NOT backward compatible
RESTART WHOLE system to ensure correctness
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3153 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/gomo.c')
-rw-r--r-- | mbbsd/gomo.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c index 3e242517..d2196bab 100644 --- a/mbbsd/gomo.c +++ b/mbbsd/gomo.c @@ -21,11 +21,6 @@ typedef struct { typedef char board_t[BRDSIZ][BRDSIZ]; typedef char (*board_p)[BRDSIZ]; -#if 0 -#define move(y,x) move(y, (x) + ((y) < 2 || (y) > 16 ? 0 : \ - (x) > 35 ? 11 : 8)) -#endif - static void gomo_init_user(const userinfo_t* uinfo, ChessUser* user); static void gomo_init_user_userec(const userec_t* urec, ChessUser* user); static void gomo_init_board(board_t board); @@ -40,26 +35,29 @@ static void gomo_drawstep(ChessInfo* info, const gomo_step_t* step); static void gomo_gameend(ChessInfo* info, ChessGameResult result); static void gomo_genlog(ChessInfo* info, FILE* fp, ChessGameResult result); -ChessActions gomo_actions = { +const static ChessActions gomo_actions = { &gomo_init_user, &gomo_init_user_userec, (void (*)(void*)) &gomo_init_board, &gomo_drawline, &gomo_movecur, &gomo_prepare_play, + NULL, &gomo_select, (void (*)(ChessInfo*, const void*)) &gomo_prepare_step, (ChessGameResult (*)(void*, const void*)) &gomo_apply_step, (void (*)(ChessInfo*, const void*)) &gomo_drawstep, + NULL, /* post_game */ &gomo_gameend, &gomo_genlog }; -ChessConstants gomo_constants = { +const static ChessConstants gomo_constants = { sizeof(gomo_step_t), MAX_TIME, BRDSIZ, BRDSIZ, + 0, "五子棋", "photo_fivechess", #ifdef GLOBAL_FIVECHESS_LOG @@ -274,7 +272,7 @@ gomo_init_user_userec(const userec_t* urec, ChessUser* user) static void gomo_init_board(board_t board) { - memset(board, 0xff, sizeof(board_t)); + memset(board, BBLANK, sizeof(board_t)); } static void @@ -290,8 +288,6 @@ gomo_drawline(const ChessInfo* info, int line) board_p board = (board_p) info->board; - move(line, 0); - clrtoeol(); if (line == 0) { prints(ANSI_COLOR(1;46) " 五子棋對戰 " ANSI_COLOR(45) "%30s VS %-20s%10s" ANSI_RESET, @@ -303,22 +299,22 @@ gomo_drawline(const ChessInfo* info, int line) const int board_line = line - 2; const char* const* const pics = board_line == 0 ? &BoardPic[0] : - board_line == 14 ? &BoardPic[6] : &BoardPic[3]; + board_line == BRDSIZ - 1 ? &BoardPic[6] : &BoardPic[3]; int i; prints("%3d" ANSI_COLOR(30;43), 17 - line); - for (i = 0; i < 15; ++i) + for (i = 0; i < BRDSIZ; ++i) if (board[board_line][i] == -1) outs(pics[BoardPicIndex[i]]); else outs(bw_chess[(int) board[board_line][i]]); outs(ANSI_RESET); - } else if (line >= 17 && line <= 23) + } else if (line >= 17 && line < b_lines) prints("%33s", ""); - ChessDrawExtraInfo(info, line); + ChessDrawExtraInfo(info, line, 8); } static void |