summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/include/proto.h1
-rw-r--r--pttbbs/mbbsd/cal.c10
-rw-r--r--pttbbs/mbbsd/chicken.c8
-rw-r--r--pttbbs/mbbsd/gamble.c12
-rw-r--r--pttbbs/mbbsd/record.c2
5 files changed, 16 insertions, 17 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index 63feecfb..772aa4b3 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -131,7 +131,6 @@ int unlockutmpmode(void);
int x_file(void);
int give_money(void);
int p_sysinfo(void);
-int do_give_money(char *id, int uid, int money);
int give_money_ui(const char *userid);
int p_give(void);
int p_cloak(void);
diff --git a/pttbbs/mbbsd/cal.c b/pttbbs/mbbsd/cal.c
index f06044f0..737a077c 100644
--- a/pttbbs/mbbsd/cal.c
+++ b/pttbbs/mbbsd/cal.c
@@ -147,8 +147,11 @@ int
p_from(void)
{
char tmp_from[sizeof(currutmp->from)];
+
if (vans("確定要改故鄉?[y/N]") != 'y')
return 0;
+
+ strlcpy(tmp_from, currutmp->from, sizeof(tmp_from));
if (getdata(b_lines - 1, 0, "請輸入新故鄉:",
tmp_from, sizeof(tmp_from), DOECHO) &&
strcmp(tmp_from, currutmp->from) != 0)
@@ -194,7 +197,7 @@ p_exmail(void)
return 0;
reload_money();
- vice(n * 1000, "購買信箱");
+ pay(n * 1000, "購買信箱");
inmailbox(n);
log_filef("log/exmailbox.log", LOG_CREAT,
"%-13s %d+%d->%d %s\n", cuser.userid,
@@ -303,7 +306,8 @@ give_money_vget_peekcb(int key, VGET_RUNTIME *prt, void *instance)
return VGETCB_NEXT;
}
-int do_give_money(char *id, int uid, int money)
+static int
+do_give_money(char *id, int uid, int money, const char *myid)
{
int tax;
@@ -468,7 +472,7 @@ give_money_ui(const char *userid)
outs("\n交易正在進行中,請稍候...\n");
refresh();
- if(do_give_money(id, uid, m) < 0)
+ if(do_give_money(id, uid, m, myid) < 0)
{
outs(ANSI_COLOR(1;31) "交易失敗!" ANSI_RESET "\n");
vmsg("交易失敗。");
diff --git a/pttbbs/mbbsd/chicken.c b/pttbbs/mbbsd/chicken.c
index 42ef48b5..907aa1c3 100644
--- a/pttbbs/mbbsd/chicken.c
+++ b/pttbbs/mbbsd/chicken.c
@@ -227,7 +227,7 @@ new_chicken(void)
vmsg("錢不夠了。");
return 0;
}
- vice(price, "寵物蛋");
+ pay(price, "寵物蛋");
// flush it
setuserfile(fn, FN_CHICKEN);
@@ -468,7 +468,7 @@ ch_buyitem(int money, const char *picture, int *item)
reload_money();
if (cuser.money/money >= num) {
*item += num;
- vice(money * num, "購買寵物");
+ pay(money * num, "購買寵物");
show_chicken_picture(picture);
pressanykey();
} else {
@@ -514,7 +514,7 @@ ch_kill(chicken_t *mychicken)
ans = vans("棄養要被罰 100 元, 是否要棄養?(y/N)");
if (ans == 'y') {
- vice(100, "棄養寵物費");
+ pay(100, "棄養寵物費");
more(CHICKEN_PIC "/deadth", YEA);
log_filef(CHICKENLOG, LOG_CREAT,
ANSI_COLOR(31) "%s " ANSI_RESET "把 " ANSI_COLOR(33) "%s" ANSI_RESET ANSI_COLOR(32) " %s "
@@ -908,7 +908,7 @@ recover_chicken(chicken_t * thechicken)
return 0;
}
revive_chicken(thechicken, 0);
- vice(money, "靈界守衛");
+ pay(money, "靈界守衛");
snprintf(buf, sizeof(buf),
ANSI_COLOR(33;44) "★靈界守衛" ANSI_COLOR(37;45)
" OK了 記得餵他點東西 不然可能失效。"
diff --git a/pttbbs/mbbsd/gamble.c b/pttbbs/mbbsd/gamble.c
index b275d02d..7993e68c 100644
--- a/pttbbs/mbbsd/gamble.c
+++ b/pttbbs/mbbsd/gamble.c
@@ -158,10 +158,7 @@ buy_ticket_ui(int money, const char *picture, int *item,
}
*item += num;
-
- // TODO uncomment this when we enable detail logs someday
- // vice(money * num, "%s賭盤[種類%d,張數%d]", title, type+1, num);
- demoney(-money * num);
+ pay(money * num, "%s賭盤[種類%d,張數%d]", title, type+1, num);
// XXX magic numbers 5, 14...
show_file(picture, 5, 14, SHOWFILE_ALLOW_ALL);
@@ -334,15 +331,12 @@ openticket(int bid)
forBM = money * 0.0005;
if(forBM > 500) forBM = 500;
-
- // XXX enable this for detail log
- // vice(-forBM, "%s 賭場抽頭", bh->brdname);
- demoney(forBM);
+ pay(-forBM, "%s 賭場抽頭", bh->brdname);
mail_redenvelop("[賭場抽頭]", cuser.userid, forBM, NULL);
money = ticket[bet] ? money * 0.95 / ticket[bet] : 9999999;
} else {
- vice(price * 10, "賭盤退錢手續費");
+ pay(price * 10, "賭盤退錢手續費");
money = price;
}
setbfile(outcome, bh->brdname, FN_TICKET_OUTCOME);
diff --git a/pttbbs/mbbsd/record.c b/pttbbs/mbbsd/record.c
index 71a9b256..afcd5e58 100644
--- a/pttbbs/mbbsd/record.c
+++ b/pttbbs/mbbsd/record.c
@@ -438,6 +438,7 @@ append_record_forward(char *fpath, fileheader_t * record, int size, const char *
return 0;
}
+// return 1 if rotated, otherwise 0
int
rotate_bin_logfile(const char *filename, off_t record_size,
off_t max_size, float keep_ratio)
@@ -454,6 +455,7 @@ rotate_bin_logfile(const char *filename, off_t record_size,
return 1;
}
+// return 1 if rotated, otherwise 0
int
rotate_text_logfile(const char *filename, off_t max_size, float keep_ratio)
{