summaryrefslogtreecommitdiffstats
path: root/mbbsd/ch_go.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-30 08:29:10 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-30 08:29:10 +0800
commit8c66da7267b5b91eb47b3321892a505e7824d5e6 (patch)
tree27fd486f52e7d5354f98808b6afeed192f57cb38 /mbbsd/ch_go.c
parent9d9efb47decf91be83230ff1f2318d6f2d981265 (diff)
downloadpttbbs-8c66da7267b5b91eb47b3321892a505e7824d5e6.tar
pttbbs-8c66da7267b5b91eb47b3321892a505e7824d5e6.tar.gz
pttbbs-8c66da7267b5b91eb47b3321892a505e7824d5e6.tar.bz2
pttbbs-8c66da7267b5b91eb47b3321892a505e7824d5e6.tar.lz
pttbbs-8c66da7267b5b91eb47b3321892a505e7824d5e6.tar.xz
pttbbs-8c66da7267b5b91eb47b3321892a505e7824d5e6.tar.zst
pttbbs-8c66da7267b5b91eb47b3321892a505e7824d5e6.zip
* (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
Diffstat (limited to 'mbbsd/ch_go.c')
-rw-r--r--mbbsd/ch_go.c31
1 files changed, 4 insertions, 27 deletions
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
@@ -793,35 +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) {
- 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)