summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-10-16 15:05:44 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-10-16 15:05:44 +0800
commit1b3798bd300369ea0c2114a262df961910e5ca6f (patch)
tree365b459ce064c1d24f05e8708c8892ba59102943 /mbbsd
parent230e45e1120bcb065dc5abca6bceb16ca1266b73 (diff)
downloadpttbbs-1b3798bd300369ea0c2114a262df961910e5ca6f.tar
pttbbs-1b3798bd300369ea0c2114a262df961910e5ca6f.tar.gz
pttbbs-1b3798bd300369ea0c2114a262df961910e5ca6f.tar.bz2
pttbbs-1b3798bd300369ea0c2114a262df961910e5ca6f.tar.lz
pttbbs-1b3798bd300369ea0c2114a262df961910e5ca6f.tar.xz
pttbbs-1b3798bd300369ea0c2114a262df961910e5ca6f.tar.zst
pttbbs-1b3798bd300369ea0c2114a262df961910e5ca6f.zip
completed assess
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1251 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/assess.c33
-rw-r--r--mbbsd/bbs.c14
-rw-r--r--mbbsd/talk.c21
3 files changed, 45 insertions, 23 deletions
diff --git a/mbbsd/assess.c b/mbbsd/assess.c
index cc5e84b1..02498263 100644
--- a/mbbsd/assess.c
+++ b/mbbsd/assess.c
@@ -1,36 +1,47 @@
#include "bbs.h"
-inline static void inc(unsigned char *num)
+
+inline static void inc(unsigned char *num, int n)
+{
+ if (SALE_MAXVALUE - *num >= n)
+ (*num) += n;
+ else
+ (*num) = SALE_MAXVALUE;
+}
+
+inline static void dec(unsigned char *num, int n)
{
- if (*num < SALE_MAXVALUE)
- (*num)++;
+ if (*num < n)
+ (*num) -= n;
+ else
+ (*num) = 0;
}
-void inc_goodpost(int uid)
+void inc_goodpost(int uid, int num)
{
passwd_query(uid, &xuser);
- inc(&xuser.goodpost);
+ inc(&xuser.goodpost, num);
passwd_update(uid, &xuser);
}
-void inc_badpost(int uid)
+void inc_badpost(int uid, int num)
{
passwd_query(uid, &xuser);
- inc(&xuser.badpost);
+ inc(&xuser.badpost, num);
passwd_update(uid, &xuser);
}
-void inc_goodsale(int uid)
+void inc_goodsale(int uid, int num)
{
passwd_query(uid, &xuser);
- inc(&xuser.goodsale);
+ inc(&xuser.goodsale, num);
passwd_update(uid, &xuser);
}
-void inc_badsale(int uid)
+void inc_badsale(int uid, int num)
{
passwd_query(uid, &xuser);
- inc(&xuser.badsale);
+ inc(&xuser.badsale, num);
passwd_update(uid, &xuser);
}
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 3ed870ed..eb4c627d 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1417,10 +1417,10 @@ do_bid(int ent, fileheader_t * fhdr, boardheader_t *bp, char *direct, struct t
if ('1' <= tmp && tmp <= '3'){
switch(tmp){
case 1:
- inc_goodsale(currutmp->uid);
+ inc_goodsale(currutmp->uid, 1);
break;
case 2:
- inc_badpost(currutmp->uid);
+ inc_badpost(currutmp->uid, 1);
break;
}
bidinfo.flag |= SALE_COMMENTED;
@@ -1581,7 +1581,7 @@ recommend(int ent, fileheader_t * fhdr, char *direct)
do_add_recommend(direct, fhdr, ent, buf);
/* 每 10 次推文 加一次 goodpost */
if ((fhdr->filemode & FILE_MARKED) && fhdr->recommend % 10 == 0)
- inc_goodpost(searchuser(fhdr->owner));
+ inc_goodpost(searchuser(fhdr->owner), 1);
lastrecommend = now;
return FULLUPDATE;
}
@@ -1601,6 +1601,12 @@ mark_post(int ent, fileheader_t * fhdr, char *direct)
return DONOTHING;
fhdr->filemode ^= FILE_MARKED;
+
+ if (fhdr->filemode)
+ inc_goodpost(searchuser(fhdr->owner), fhdr->recommend);
+ else
+ inc_badpost(searchuser(fhdr->owner), fhdr->recommend);
+
substitute_record(direct, fhdr, sizeof(*fhdr), ent);
substitute_check(fhdr);
touchdircache(currbid);
@@ -1726,7 +1732,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
delete_file(genbuf, sizeof(fileheader_t), num, cmpfilename);
}
if (not_owned)
- inc_badpost(searchuser(fhdr->owner));
+ inc_badpost(searchuser(fhdr->owner), 1);
cancelpost(fhdr, not_owned);
setbtotal(currbid);
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index d53e1618..b1a3d712 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -346,20 +346,24 @@ my_query(char *uident)
setutmpmode(TQUERY);
currutmp->destuid = tuid;
+ if ((uentp = (userinfo_t *) search_ulist(tuid)))
+ fri_stat = friend_stat(currutmp, uentp);
+
j = muser.money;
for (i = 0; i < 10 && j > 10; i++)
j /= 10;
- prints("《ID暱稱》%s(%s)%*s《經濟狀況》%s\n",
+ prints("《ID暱稱》%s(%s)%*s《經濟狀況》%s",
muser.userid,
muser.username,
26 - strlen(muser.userid) - strlen(muser.username), "",
money[i]);
+ if ((uentp && ((fri_stat & HFM) || strcmp(muser.userid,cuser.userid) == 0) && !uentp->invisible))
+ prints(" (%d)", muser.money);
+ prints("\n");
prints("《上站次數》%d次", muser.numlogins);
move(2, 40);
prints("《文章篇數》%d篇\n", muser.numposts);
- if ((uentp = (userinfo_t *) search_ulist(tuid)))
- fri_stat = friend_stat(currutmp, uentp);
prints("\033[1;33m《目前動態》%-28.28s\033[m",
(uentp && isvisible_stat(currutmp, uentp, fri_stat)) ?
modestring(uentp, 0) : "不在站上");
@@ -370,14 +374,15 @@ my_query(char *uident)
prints("《上次上站》%-28.28s《上次故鄉》%s\n",
Cdate(&muser.lastlogin),
(muser.lasthost[0] ? muser.lasthost : "(不詳)"));
- if ((uentp && ((fri_stat & HFM) || strcmp(muser.userid,cuser.userid) == 0) && !uentp->invisible))
- prints("《 性 別 》%-28.28s《私有財產》%d 銀兩\n",
- sex[muser.sex % 8],
- muser.money);
+ prints("《文章評比》 優 %-3d 劣 %-3d 《競標評比》 優 %-3d 劣 %-3d\n",
+ muser.goodpost, muser.badpost,
+ muser.goodsale, muser.badsale);
prints("《五子棋戰績》%3d 勝 %3d 敗 %3d 和 "
- "《象棋戰績》%3d 勝 %3d 敗 %3d 和",
+ "《象棋戰績》%3d 勝 %3d 敗 %3d 和\n",
muser.five_win, muser.five_lose, muser.five_tie,
muser.chc_win, muser.chc_lose, muser.chc_tie);
+ if ((uentp && ((fri_stat & HFM) || strcmp(muser.userid,cuser.userid) == 0) && !uentp->invisible))
+ prints("《 性 別 》%-28.28s\n", sex[muser.sex % 8]);
showplans(uident);
pressanykey();
return FULLUPDATE;