summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pttstruct.h5
-rw-r--r--mbbsd/cache.c14
-rw-r--r--mbbsd/chc_play.c5
-rw-r--r--mbbsd/mbbsd.c5
-rw-r--r--mbbsd/talk.c18
5 files changed, 37 insertions, 10 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 7d546415..29984823 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -1,4 +1,4 @@
-/* $Id: pttstruct.h,v 1.26 2002/11/07 09:13:23 in2 Exp $ */
+/* $Id: pttstruct.h,v 1.27 2002/11/16 13:41:06 kcwu Exp $ */
#ifndef INCLUDE_STRUCT_H
#define INCLUDE_STRUCT_H
@@ -243,6 +243,9 @@ typedef struct userinfo_t {
unsigned short int five_win;
unsigned short int five_lose;
unsigned short int five_tie;
+ unsigned short int chc_win;
+ unsigned short int chc_lose;
+ unsigned short int chc_tie;
int mailalert;
int sex;
char color;
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index ff3a8340..1289dd51 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -1,4 +1,4 @@
-/* $Id: cache.c,v 1.52 2002/10/23 17:10:04 in2 Exp $ */
+/* $Id: cache.c,v 1.53 2002/11/16 13:41:07 kcwu Exp $ */
#include "bbs.h"
#ifndef __FreeBSD__
@@ -374,6 +374,17 @@ cmputmpfive(const void *i, const void *j)
}
static int
+cmputmpchc(const void *i, const void *j)
+{
+ int type;
+ if ((type = (*((userinfo_t **) j))->chc_win - (*((userinfo_t **) i))->chc_win))
+ return type;
+ if ((type = (*((userinfo_t **) i))->chc_lose - (*((userinfo_t **) j))->chc_lose))
+ return type;
+ return (*((userinfo_t **) i))->chc_tie - (*((userinfo_t **) j))->chc_tie;
+}
+
+static int
cmputmppid(const void *i, const void *j)
{
return (*((userinfo_t **) i))->pid - (*((userinfo_t **) j))->pid;
@@ -422,6 +433,7 @@ sort_utmp()
qsort(SHM->sorted[ns][2], count, sizeof(userinfo_t *), cmputmpidle);
qsort(SHM->sorted[ns][3], count, sizeof(userinfo_t *), cmputmpfrom);
qsort(SHM->sorted[ns][4], count, sizeof(userinfo_t *), cmputmpfive);
+ qsort(SHM->sorted[ns][5], count, sizeof(userinfo_t *), cmputmpchc);
qsort(SHM->sorted[ns][6], count, sizeof(userinfo_t *), cmputmpuid);
qsort(SHM->sorted[ns][7], count, sizeof(userinfo_t *), cmputmppid);
SHM->currsorted = ns;
diff --git a/mbbsd/chc_play.c b/mbbsd/chc_play.c
index 74a9aadb..08eead20 100644
--- a/mbbsd/chc_play.c
+++ b/mbbsd/chc_play.c
@@ -1,4 +1,4 @@
-/* $Id: chc_play.c,v 1.6 2002/07/21 09:26:02 in2 Exp $ */
+/* $Id: chc_play.c,v 1.7 2002/11/16 13:41:07 kcwu Exp $ */
#include "bbs.h"
typedef int (*play_func_t) (int, board_t, board_t);
@@ -201,12 +201,15 @@ mainloop(int s, board_t board)
if (endgame == 1) {
strlcpy(chc_warnmsg, "對方認輸了!", sizeof(chc_warnmsg));
cuser.chc_win++;
+ currutmp->chc_win++;
} else if (endgame == 2) {
strlcpy(chc_warnmsg, "你認輸了!", sizeof(chc_warnmsg));
cuser.chc_lose++;
+ currutmp->chc_lose++;
} else {
strlcpy(chc_warnmsg, "和棋", sizeof(chc_warnmsg));
cuser.chc_tie++;
+ currutmp->chc_tie++;
}
cuser.chc_lose--;
passwd_update(usernum, &cuser);
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 0adb2756..0f2cd58f 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1,4 +1,4 @@
-/* $Id: mbbsd.c,v 1.58 2002/09/26 16:18:36 in2 Exp $ */
+/* $Id: mbbsd.c,v 1.59 2002/11/16 13:41:07 kcwu Exp $ */
#include "bbs.h"
#define SOCKET_QLEN 4
@@ -723,6 +723,9 @@ setup_utmp(int mode)
uinfo.five_win = cuser.five_win;
uinfo.five_lose = cuser.five_lose;
uinfo.five_tie = cuser.five_tie;
+ uinfo.chc_win = cuser.chc_win;
+ uinfo.chc_lose = cuser.chc_lose;
+ uinfo.chc_tie = cuser.chc_tie;
uinfo.invisible = cuser.invisible % 2;
uinfo.pager = cuser.pager % 5;
memcpy(uinfo.mind, cuser.mind, 4);
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 52f35173..76c1276f 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1,4 +1,4 @@
-/* $Id: talk.c,v 1.94 2002/09/20 13:37:46 in2 Exp $ */
+/* $Id: talk.c,v 1.95 2002/11/16 13:41:07 kcwu Exp $ */
#include "bbs.h"
#define QCAST int (*)(const void *, const void *)
@@ -10,7 +10,7 @@ static char *sig_des[] = {
"鬥雞", "聊天", "", "下棋", "象棋", "暗棋"
};
-#define MAX_SHOW_MODE 3
+#define MAX_SHOW_MODE 4
#define M_INT 15 /* monitor mode update interval */
#define P_INT 20 /* interval to check for page req. in
* talk/chat */
@@ -31,7 +31,7 @@ typedef struct pickup_t {
/* 記錄 friend 的 user number */
//
-#define PICKUP_WAYS 6
+#define PICKUP_WAYS 7
static char *fcolor[11] = {
"", "\033[36m", "\033[32m", "\033[1;32m",
@@ -1457,6 +1457,12 @@ descript(int show_mode, userinfo_t * uentp, time_t diff)
uentp->five_lose, uentp->five_tie);
description[20] = 0;
return description;
+ case 3:
+ snprintf(description, sizeof(description),
+ "%3d/%3d/%3d", uentp->chc_win,
+ uentp->chc_lose, uentp->chc_tie);
+ description[20] = 0;
+ return description;
default:
syslog(LOG_WARNING, "damn!!! what's wrong?? show_mode = %d",
show_mode);
@@ -1622,10 +1628,10 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way,
int show_pid, int myfriend, int friendme, int bfriend, int badfriend)
{
char *msg_pickup_way[PICKUP_WAYS] = {
- "嗨! 朋友", "網友代號", "網友動態", "發呆時間", "來自何方", "五子棋 "
+ "嗨! 朋友", "網友代號", "網友動態", "發呆時間", "來自何方", " 五子棋 ", " 象棋 "
};
char *MODE_STRING[MAX_SHOW_MODE] = {
- "故鄉", "好友描述", "五子棋戰績"
+ "故鄉", "好友描述", "五子棋戰績", "象棋戰績"
};
char pagerchar[5] = "* -Wf";
@@ -2089,7 +2095,7 @@ userlist(void)
break;
case 'S': /* 顯示好友描述 */
- show_mode = (++show_mode) % MAX_SHOW_MODE;
+ show_mode = (show_mode+1) % MAX_SHOW_MODE;
redrawall = redraw = 1;
break;