diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-03-12 19:25:53 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2006-03-12 19:25:53 +0800 |
commit | b729272d521985d2656660d2f83a3a29c8f6ec8f (patch) | |
tree | e3e9d4dd1ddf67e5499cab0479d52af52c721264 /mbbsd/go.c | |
parent | 097b557f8d8698c6992a4fdb510f76fd07229b64 (diff) | |
download | pttbbs-b729272d521985d2656660d2f83a3a29c8f6ec8f.tar pttbbs-b729272d521985d2656660d2f83a3a29c8f6ec8f.tar.gz pttbbs-b729272d521985d2656660d2f83a3a29c8f6ec8f.tar.bz2 pttbbs-b729272d521985d2656660d2f83a3a29c8f6ec8f.tar.lz pttbbs-b729272d521985d2656660d2f83a3a29c8f6ec8f.tar.xz pttbbs-b729272d521985d2656660d2f83a3a29c8f6ec8f.tar.zst pttbbs-b729272d521985d2656660d2f83a3a29c8f6ec8f.zip |
GO scoring and displaying on userlist.
!!!NOTE: shared memory changed!!!
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3276 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/go.c')
-rw-r--r-- | mbbsd/go.c | 36 |
1 files changed, 28 insertions, 8 deletions
@@ -451,18 +451,18 @@ static void go_init_user(const userinfo_t* uinfo, ChessUser* user) { strlcpy(user->userid, uinfo->userid, sizeof(user->userid)); - user->win = 0; - user->lose = 0; - user->tie = 0; + user->win = uinfo->go_win; + user->lose = uinfo->go_lose; + user->tie = uinfo->go_tie; } static void go_init_user_userec(const userec_t* urec, ChessUser* user) { strlcpy(user->userid, urec->userid, sizeof(user->userid)); - user->win = 0; - user->lose = 0; - user->tie = 0; + user->win = urec->go_win; + user->lose = urec->go_lose; + user->tie = urec->go_tie; } static void @@ -793,8 +793,28 @@ go_post_game(ChessInfo* info) static void go_gameend(ChessInfo* info, ChessGameResult result) { - /* TODO: implement */ - if (info->mode == CHESS_MODE_REPLAY) { + if (info->mode == CHESS_MODE_VERSUS) { + ChessUser* const user1 = &info->user1; + /* ChessUser* const user2 = &info->user2; */ + + user1->lose--; + if (result == CHESS_RESULT_WIN) { + user1->win++; + currutmp->go_win++; + } else if (result == CHESS_RESULT_LOST) { + user1->lose++; + currutmp->go_lose++; + } else { + user1->tie++; + currutmp->go_tie++; + } + + cuser.go_win = user1->win; + cuser.go_lose = user1->lose; + cuser.go_tie = user1->tie; + + passwd_update(usernum, &cuser); + } else if (info->mode == CHESS_MODE_REPLAY) { free(info->board); free(info->tag); } |