summaryrefslogtreecommitdiffstats
path: root/mbbsd/chc.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-10-31 19:53:17 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-10-31 19:53:17 +0800
commit6f896bea66286ad637861ccae7126fda98c0c4ff (patch)
tree2c76bdbb8e1d1a049e7d09c0764ea7d99afe2ddf /mbbsd/chc.c
parent4b5bac6a3c1bd493bb89e6973a0849977e6bbf11 (diff)
downloadpttbbs-6f896bea66286ad637861ccae7126fda98c0c4ff.tar
pttbbs-6f896bea66286ad637861ccae7126fda98c0c4ff.tar.gz
pttbbs-6f896bea66286ad637861ccae7126fda98c0c4ff.tar.bz2
pttbbs-6f896bea66286ad637861ccae7126fda98c0c4ff.tar.lz
pttbbs-6f896bea66286ad637861ccae7126fda98c0c4ff.tar.xz
pttbbs-6f896bea66286ad637861ccae7126fda98c0c4ff.tar.zst
pttbbs-6f896bea66286ad637861ccae7126fda98c0c4ff.zip
treat lose and decrease chess rating if disconnected
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2301 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/chc.c')
-rw-r--r--mbbsd/chc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mbbsd/chc.c b/mbbsd/chc.c
index f2c22fbd..c4f20dff 100644
--- a/mbbsd/chc.c
+++ b/mbbsd/chc.c
@@ -620,6 +620,7 @@ chcusr_get(userec_t *userec, chcusr_t *user)
user->rating = userec->chess_elo_rating;
if(user->rating == 0)
user->rating = 1500; /* ELO initial value */
+ user->orig_rating = user->rating;
}
static int
@@ -813,6 +814,7 @@ count_chess_elo_rating(chcusr_t *user1, chcusr_t *user2, double myres)
{
double k;
double exp_res;
+
if(user1->rating < 1800)
k = 30;
else if(user1->rating < 2000)
@@ -850,7 +852,8 @@ mainloop(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t pla
}
if (chc_mode & CHC_VERSUS) {
- /* XXX 不正常斷線目前不會更改 ELO rating */
+ user1->rating = user1->orig_rating;
+ user1->lose--;
if (endgame == 1) {
strlcpy(chc_warnmsg, "對方認輸了!", sizeof(chc_warnmsg));
count_chess_elo_rating(user1, user2, 1.0);
@@ -868,7 +871,6 @@ mainloop(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t pla
currutmp->chc_tie++;
}
currutmp->chess_elo_rating = user1->rating;
- user1->lose--;
chcusr_put(&cuser, user1);
passwd_update(usernum, &cuser);
}
@@ -1017,6 +1019,7 @@ chc_init(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t pla
// chc_broadcast_recv(act_list, board);
user1->lose++;
+ count_chess_elo_rating(user1, user2, 0.0);
if (chc_mode & CHC_VERSUS) {
passwd_query(usernum, &xuser);