From e40b5f174956a652514959e367df348c0ad66d9f Mon Sep 17 00:00:00 2001 From: piaip Date: Sat, 29 Aug 2009 12:59:17 +0000 Subject: * enable lastseen and CONST_CUSER, also use cuser_ref as "&cuser". git-svn-id: http://opensvn.csie.org/pttbbs/branches/pttbbs.pwcu@4786 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/ch_go.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'mbbsd/ch_go.c') diff --git a/mbbsd/ch_go.c b/mbbsd/ch_go.c index 9c7256cd..a9e68005 100644 --- a/mbbsd/ch_go.c +++ b/mbbsd/ch_go.c @@ -819,9 +819,9 @@ go_gameend(ChessInfo* info, ChessGameResult result) currutmp->go_tie++; } - go_usr_put(&cuser, user1); + go_usr_put(cuser_ref, user1); - passwd_sync_update(usernum, &cuser); + passwd_sync_update(usernum, cuser_ref); } else if (info->mode == CHESS_MODE_REPLAY) { free(info->board); free(info->tag); @@ -936,9 +936,9 @@ gochess(int s, ChessGameMode mode) if (info->mode == CHESS_MODE_VERSUS) { /* Assume that info->user1 is me. */ info->user1.lose++; - passwd_sync_query(usernum, &cuser); - go_usr_put(&cuser, &info->user1); - passwd_sync_update(usernum, &cuser); + passwd_sync_query(usernum, cuser_ref); + go_usr_put(cuser_ref, &info->user1); + passwd_sync_update(usernum, cuser_ref); } if (mode == CHESS_MODE_WATCH) -- cgit v1.2.3 From 8c66da7267b5b91eb47b3321892a505e7824d5e6 Mon Sep 17 00:00:00 2001 From: piaip Date: Sun, 30 Aug 2009 00:29:10 +0000 Subject: * (pwch branch) change chess results to use pwcu API git-svn-id: http://opensvn.csie.org/pttbbs/branches/pttbbs.pwcu@4793 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/ch_go.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'mbbsd/ch_go.c') diff --git a/mbbsd/ch_go.c b/mbbsd/ch_go.c index a9e68005..308061b8 100644 --- a/mbbsd/ch_go.c +++ b/mbbsd/ch_go.c @@ -792,36 +792,15 @@ 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) { 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++; - } - go_usr_put(cuser_ref, user1); + // lost was already initialized + if (result != CHESS_RESULT_LOST) + pwcuChessResult(SIG_GO, result); - passwd_sync_update(usernum, cuser_ref); } else if (info->mode == CHESS_MODE_REPLAY) { free(info->board); free(info->tag); @@ -936,9 +915,7 @@ gochess(int s, ChessGameMode mode) if (info->mode == CHESS_MODE_VERSUS) { /* Assume that info->user1 is me. */ info->user1.lose++; - passwd_sync_query(usernum, cuser_ref); - go_usr_put(cuser_ref, &info->user1); - passwd_sync_update(usernum, cuser_ref); + pwcuChessResult(SIG_GO, CHESS_RESULT_LOST); } if (mode == CHESS_MODE_WATCH) -- cgit v1.2.3