summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 ? "並非兩人都養寵物" :
"有一方的寵物正在使用中");