From a0f8ef1e2e04905908478088fc376435b770417c Mon Sep 17 00:00:00 2001 From: piaip Date: Wed, 8 Jun 2005 02:46:24 +0000 Subject: New style to specify ANSI escape commands. First introduced by pmore, but this hard work (to transform all files to new style) is made by Rong-en Fan (rafan). Thanks! git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2796 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/go.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'mbbsd/go.c') diff --git a/mbbsd/go.c b/mbbsd/go.c index 0f2274f0..9cf1e0ac 100644 --- a/mbbsd/go.c +++ b/mbbsd/go.c @@ -435,7 +435,7 @@ GO_log(struct GOData *gd, char *userid) } else snprintf(mymail.title, sizeof(mymail.title), - "\033[37;41m棋譜\033[m %s VS %s", cuser.userid, userid); + ANSI_COLOR(37;41) "棋譜" ANSI_RESET " %s VS %s", cuser.userid, userid); sethomedir(title, cuser.userid); append_record(title, &mymail, sizeof(mymail)); @@ -702,7 +702,7 @@ gochess(int fd) } */ - prints("\033[1;46m 圍棋對戰 \033[45m%31s VS %-31s\033[m", + prints(ANSI_COLOR(1;46) " 圍棋對戰 " ANSI_COLOR(45) "%31s VS %-31s" ANSI_RESET, cuser.userid, my->mateid); GO_cleantable(); @@ -756,24 +756,24 @@ gochess(int fd) if (v == pool) { if (gd.me == BWHITE && gd.win != 0) - outs("\033[1;33m按 x 讓子 y 不限時 Ctrl-C 中止棋局\033[m"); + outs(ANSI_COLOR(1;33) "按 x 讓子 y 不限時 Ctrl-C 中止棋局" ANSI_RESET); else - outs("\033[1;33m按 Ctrl-C 中止棋局\033[m"); + outs(ANSI_COLOR(1;33) "按 Ctrl-C 中止棋局" ANSI_RESET); } else if (passflag && my->turn) { if (endflag) - outs("\033[1;33m對方 DONE,己方 DONE 就計算結果\033[m"); + outs(ANSI_COLOR(1;33) "對方 DONE,己方 DONE 就計算結果" ANSI_RESET); else - outs("\033[1;33m對方 PASS,己方 PASS 就結束棋局\033[m"); + outs(ANSI_COLOR(1;33) "對方 PASS,己方 PASS 就結束棋局" ANSI_RESET); } else if (v > pool) clrtoeol(); if (endflag) - outmsg("\033[1;33;42m 下棋 \033[;31;47m (←↑↓→)\033[30m移動 \033[31m(空白鍵/ENTER)\033[30m下子 \033[31m(v)\033[30m傳訊 \033[31m(z)\033[30m投降 \033[31m(w)\033[30mDONE \033[31m(u)\033[30m回復 \033[m"); + outmsg(ANSI_COLOR(1;33;42) " 下棋 " ANSI_COLOR(;31;47) " (←↑↓→)" ANSI_COLOR(30) "移動 " ANSI_COLOR(31) "(空白鍵/ENTER)" ANSI_COLOR(30) "下子 " ANSI_COLOR(31) "(v)" ANSI_COLOR(30) "傳訊 " ANSI_COLOR(31) "(z)" ANSI_COLOR(30) "投降 " ANSI_COLOR(31) "(w)" ANSI_COLOR(30) "DONE " ANSI_COLOR(31) "(u)" ANSI_COLOR(30) "回復 " ANSI_RESET); else - outmsg("\033[1;33;42m 下棋 \033[;31;47m (←↑↓→)\033[30m移動 \033[31m(空白鍵/ENTER)\033[30m下子 \033[31m(v)\033[30m傳訊 \033[31m(z)\033[30m投降 \033[31m(w)\033[30mPASS \033[m"); + outmsg(ANSI_COLOR(1;33;42) " 下棋 " ANSI_COLOR(;31;47) " (←↑↓→)" ANSI_COLOR(30) "移動 " ANSI_COLOR(31) "(空白鍵/ENTER)" ANSI_COLOR(30) "下子 " ANSI_COLOR(31) "(v)" ANSI_COLOR(30) "傳訊 " ANSI_COLOR(31) "(z)" ANSI_COLOR(30) "投降 " ANSI_COLOR(31) "(w)" ANSI_COLOR(30) "PASS " ANSI_RESET); redoscr(); scr_need_redraw = 0; @@ -784,10 +784,10 @@ gochess(int fd) char buf[128]; int n; //move(5, 46); - n = sprintf(buf, "\033[6;47H%s 方時間:----- --", bw_chess[gd.me - 1]); + n = sprintf(buf, ANSI_MOVETO(6,47) "%s 方時間:----- --", bw_chess[gd.me - 1]); output(buf, n); //move(6, 46); - n = sprintf(buf, "\033[7;47H%s 方時間:----- --", bw_chess[gd.he - 1]); + n = sprintf(buf, ANSI_MOVETO(7,47) "%s 方時間:----- --", bw_chess[gd.he - 1]); output(buf, n); } else @@ -836,13 +836,13 @@ gochess(int fd) char buf[128]; int n; //move(5, 46); - n = sprintf(buf, "\033[6;47H%s 方時間:%02d:%02d ", + n = sprintf(buf, ANSI_MOVETO(6,47) "%s 方時間:%02d:%02d ", bw_chess[gd.me - 1], mtime / 60, mtime % 60); if (mhand <= 25) n += sprintf(buf + n, "%2d 手", 25 - mhand); output(buf, n); //move(6, 46); - n = sprintf(buf, "\033[7;47H%s 方時間:%02d:%02d ", + n = sprintf(buf, ANSI_MOVETO(7,47) "%s 方時間:%02d:%02d ", bw_chess[gd.he - 1], htime / 60, htime % 60); if (hhand <= 25) n += sprintf(buf + n, "%2d 手", 25 - hhand); @@ -1339,7 +1339,7 @@ GoBot(void) clear(); - prints("\033[1;46m 圍棋打譜 \033[45m%66s\033[m", " "); + prints(ANSI_COLOR(1;46) " 圍棋打譜 " ANSI_COLOR(45) "%66s" ANSI_RESET, " "); GO_cleantable(); /* film_out(FILM_GO, 1); */ @@ -1373,7 +1373,7 @@ GoBot(void) prints("%s #%-3d %.1s%-2d ", bw_chess[(i - 1) & 1], i, locE + pool[i - 1].x, pool[i - 1].y + 1); } - outmsg(" 打譜  (←↑↓→)移動 (空白鍵/ENTER)下子 (u)回上一步 \033[31m(z)\033[30m離開 "); + outmsg(" 打譜  (←↑↓→)移動 (空白鍵/ENTER)下子 (u)回上一步 " ANSI_COLOR(31) "(z)" ANSI_COLOR(30) "離開 "); redoscr(); scr_need_redraw = 0; } -- cgit v1.2.3