diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-03 23:51:36 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-04-03 23:51:36 +0800 |
commit | 740fab325a698120c5847e27662cccc87ec0d3aa (patch) | |
tree | 6c76dc024790fecd31e86aed7cfdf9573a4628f7 | |
parent | 3874e732f9f9b9a85df1a044137c9a083e3fc722 (diff) | |
download | pttbbs-740fab325a698120c5847e27662cccc87ec0d3aa.tar pttbbs-740fab325a698120c5847e27662cccc87ec0d3aa.tar.gz pttbbs-740fab325a698120c5847e27662cccc87ec0d3aa.tar.bz2 pttbbs-740fab325a698120c5847e27662cccc87ec0d3aa.tar.lz pttbbs-740fab325a698120c5847e27662cccc87ec0d3aa.tar.xz pttbbs-740fab325a698120c5847e27662cccc87ec0d3aa.tar.zst pttbbs-740fab325a698120c5847e27662cccc87ec0d3aa.zip |
- 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
-rw-r--r-- | mbbsd/go.c | 21 | ||||
-rw-r--r-- | mbbsd/gomo.c | 4 |
2 files changed, 19 insertions, 6 deletions
@@ -793,6 +793,14 @@ go_post_game(ChessInfo* info) } 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) { if (info->mode == CHESS_MODE_VERSUS) { @@ -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) { |