diff options
-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) { |