From 740fab325a698120c5847e27662cccc87ec0d3aa Mon Sep 17 00:00:00 2001 From: piaip Date: Thu, 3 Apr 2008 15:51:36 +0000 Subject: - fix go score calculation (prior will have 'lose' overflow - forget to increase at first) git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4075 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/go.c | 21 ++++++++++++++++++--- mbbsd/gomo.c | 4 +--- 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/go.c b/mbbsd/go.c index 4e0445b5..aca63de4 100644 --- a/mbbsd/go.c +++ b/mbbsd/go.c @@ -792,6 +792,14 @@ go_post_game(ChessInfo* info) return result; } +static void +go_usr_put(userec_t* userec, const ChessUser* user) +{ + userec->go_win = user->win; + userec->go_lose = user->lose; + userec->go_tie = user->tie; +} + static void go_gameend(ChessInfo* info, ChessGameResult result) { @@ -811,9 +819,7 @@ go_gameend(ChessInfo* info, ChessGameResult result) currutmp->go_tie++; } - cuser.go_win = user1->win; - cuser.go_lose = user1->lose; - cuser.go_tie = user1->tie; + go_usr_put(&cuser, user1); passwd_update(usernum, &cuser); } else if (info->mode == CHESS_MODE_REPLAY) { @@ -926,6 +932,15 @@ gochess(int s, ChessGameMode mode) info->cursor.r = 9; info->cursor.c = 9; + // copied from gomo.c + if (info->mode == CHESS_MODE_VERSUS) { + /* Assume that info->user1 is me. */ + info->user1.lose++; + passwd_query(usernum, &cuser); + go_usr_put(&cuser, &info->user1); + passwd_update(usernum, &cuser); + } + if (mode == CHESS_MODE_WATCH) setutmpmode(CHESSWATCHING); else diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c index 0caa7c4d..ec992361 100644 --- a/mbbsd/gomo.c +++ b/mbbsd/gomo.c @@ -408,9 +408,7 @@ gomo_gameend(ChessInfo* info, ChessGameResult result) currutmp->five_tie++; } - cuser.five_win = user1->win; - cuser.five_lose = user1->lose; - cuser.five_tie = user1->tie; + gomo_usr_put(&cuser, user1); passwd_update(usernum, &cuser); } else if (info->mode == CHESS_MODE_REPLAY) { -- cgit v1.2.3