diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-15 17:15:20 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-15 17:15:20 +0800 |
commit | 7cf467de869336579256b535fa605b0aa53b991c (patch) | |
tree | 4d66cef7000f24e060e4f970dfeb9842da83b290 | |
parent | 98f0f5e0a45c6771ce43d69a13aa9b9ecce3faf9 (diff) | |
download | pttbbs-7cf467de869336579256b535fa605b0aa53b991c.tar pttbbs-7cf467de869336579256b535fa605b0aa53b991c.tar.gz pttbbs-7cf467de869336579256b535fa605b0aa53b991c.tar.bz2 pttbbs-7cf467de869336579256b535fa605b0aa53b991c.tar.lz pttbbs-7cf467de869336579256b535fa605b0aa53b991c.tar.xz pttbbs-7cf467de869336579256b535fa605b0aa53b991c.tar.zst pttbbs-7cf467de869336579256b535fa605b0aa53b991c.zip |
gomoku and go logging update
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3037 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/chess.c | 3 | ||||
-rw-r--r-- | mbbsd/go.c | 4 | ||||
-rw-r--r-- | mbbsd/gomo.c | 13 |
3 files changed, 11 insertions, 9 deletions
diff --git a/mbbsd/chess.c b/mbbsd/chess.c index 1b585f12..255f1ed6 100644 --- a/mbbsd/chess.c +++ b/mbbsd/chess.c @@ -704,8 +704,7 @@ ChessGenLogGlobal(ChessInfo* info, ChessGameResult result) fclose(fp); strlcpy(log_header.owner, "[棋譜機器人]", sizeof(log_header.owner)); - snprintf(log_header.title, sizeof(log_header.title), - ANSI_COLOR(37;41) "棋譜" ANSI_RESET " %s VS %s", + snprintf(log_header.title, sizeof(log_header.title), "[棋譜] %s VS %s", info->user1.userid, info->user2.userid); setbdir(buf, info->constants->log_board); @@ -386,7 +386,7 @@ GO_log(struct GOData *gd, char *userid) } while (++ptr < v); - fprintf(fp, "\n\n《以下為 sgf 格式棋譜》\n\n(;GM[1]"); + fprintf(fp, "\n\n《以下為 sgf 格式棋譜》\n<golog>\n(;GM[1]"); if (userid == NULL) fprintf(fp, "GN[Gobot-Gobot FPG]\n"); else @@ -423,7 +423,7 @@ GO_log(struct GOData *gd, char *userid) i++; } while (++ptr < v); - fprintf(fp, ";)\n\n"); + fprintf(fp, ";)\n<golog>\n\n"); fclose(fp); mymail.filemode = FILE_READ; diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c index 561c4003..6c08565f 100644 --- a/mbbsd/gomo.c +++ b/mbbsd/gomo.c @@ -238,8 +238,8 @@ static char* gomo_getstep(const gomo_step_t* step, char buf[]) { const static char* const ColName = "ABCDEFGHIJKLMN"; - const static char* const RawName = "123456789101112131415"; - const static int ansi_length = sizeof(ANSI_COLOR(30;43)); + const static char* const RawName = "151413121110987654321"; + const static int ansi_length = sizeof(ANSI_COLOR(30;43)) - 1; strcpy(buf, turn_color[step->color]); buf[ansi_length ] = ColName[step->loc.c * 2]; @@ -410,7 +410,7 @@ gomo_genlog(ChessInfo* info, FILE* fp, ChessGameResult result) const int nStep = info->history.used; int i; - for (i = 1; i < 18; i++) + for (i = 1; i <= 18; i++) fprintf(fp, "%.*s\n", big_picture[i].len, big_picture[i].data); fprintf(fp, "<gomokulog>\nblack:%s\nwhite:%s\n", @@ -420,8 +420,11 @@ gomo_genlog(ChessInfo* info, FILE* fp, ChessGameResult result) for (i = 0; i < nStep; ++i) { const gomo_step_t* const step = (const gomo_step_t*) ChessHistoryRetrieve(info, i); - fprintf(fp, "[%2d]%s ==> %c%-5d", i + 1, bw_chess[i % 2], - 'A' + step->loc.c, step->loc.r + 1); + if (step->type == CHESS_STEP_NORMAL) + fprintf(fp, "[%2d]%s ==> %c%-5d", i + 1, bw_chess[step->color], + 'A' + step->loc.c, 15 - step->loc.r); + else + break; if (i % 2) fputc('\n', fp); } |