summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-06 20:33:34 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-06 20:33:34 +0800
commite2edcb13a0eb21598f99ecc7a4e2627aa1c79bae (patch)
tree5d18e80d1e50cab54a387f1afb57dd432131429c
parenta1d171bf72cc949f8852258cf36016cbc70d98b9 (diff)
downloadpttbbs-e2edcb13a0eb21598f99ecc7a4e2627aa1c79bae.tar
pttbbs-e2edcb13a0eb21598f99ecc7a4e2627aa1c79bae.tar.gz
pttbbs-e2edcb13a0eb21598f99ecc7a4e2627aa1c79bae.tar.bz2
pttbbs-e2edcb13a0eb21598f99ecc7a4e2627aa1c79bae.tar.lz
pttbbs-e2edcb13a0eb21598f99ecc7a4e2627aa1c79bae.tar.xz
pttbbs-e2edcb13a0eb21598f99ecc7a4e2627aa1c79bae.tar.zst
pttbbs-e2edcb13a0eb21598f99ecc7a4e2627aa1c79bae.zip
- chicken: enable PK with new mmap style
- userec_t: comments for deprecated chicken data git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3969 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h1
-rw-r--r--include/pttstruct.h2
-rw-r--r--mbbsd/talk.c6
3 files changed, 6 insertions, 3 deletions
diff --git a/include/proto.h b/include/proto.h
index ebab4084..705992cd 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -214,6 +214,7 @@ int reload_chicken(void);
void chicken_query(const char *userid);
void ch_buyitem(int money, const char *picture, int *item, int haveticket);
void show_chicken_data(chicken_t *thechicken, chicken_t *pkchicken);
+int load_chicken(const char *uid, chicken_t *mychicken);
/* dark */
int main_dark(int fd,userinfo_t *uin);
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 056a837e..2dac5e79 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -85,7 +85,7 @@ typedef struct userec_t {
unsigned char invisible; /* 隱形狀態 */
char padxx[2];
unsigned int exmailbox; /* 購買信箱數 TODO short 就夠了 */
- chicken_t mychicken; /* 寵物 */
+ chicken_t old_chicken; // mychicken; /* 寵物, r3968 後移出。 使用前請記得先 memset 此欄位。 */
time4_t lastsong; /* 上次點歌時間 */
unsigned int loginview; /* 進站畫面 */
unsigned char channel; /* TODO unused */
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 751fb897..138dde54 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -1761,14 +1761,16 @@ my_talk(userinfo_t * uin, int fri_stat, char defact)
case 'p':
{
userec_t xuser;
+ chicken_t xchk;
int error = 0;
- reload_chicken();
getuser(uin->userid, &xuser);
if (uin->lockmode == CHICKEN || currutmp->lockmode == CHICKEN)
error = 1;
- if (!cuser.mychicken.name[0] || !xuser.mychicken.name[0])
+ else if (!load_chicken(cuser.userid, &xchk) ||
+ !load_chicken(xuser.userid, &xchk))
error = 2;
+
if (error) {
vmsg(error == 2 ? "並非兩人都養寵物" :
"有一方的寵物正在使用中");