summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-11 10:00:31 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-11 10:00:31 +0800
commite7fef1f83a6c2f397dacc520a07d8578d2551b44 (patch)
tree9874ed554b03c4d47636b9f670f7de366a553eec /mbbsd
parenta76ca91e320884b3b4ef1a9f6bb538ae10850583 (diff)
downloadpttbbs-e7fef1f83a6c2f397dacc520a07d8578d2551b44.tar
pttbbs-e7fef1f83a6c2f397dacc520a07d8578d2551b44.tar.gz
pttbbs-e7fef1f83a6c2f397dacc520a07d8578d2551b44.tar.bz2
pttbbs-e7fef1f83a6c2f397dacc520a07d8578d2551b44.tar.lz
pttbbs-e7fef1f83a6c2f397dacc520a07d8578d2551b44.tar.xz
pttbbs-e7fef1f83a6c2f397dacc520a07d8578d2551b44.tar.zst
pttbbs-e7fef1f83a6c2f397dacc520a07d8578d2551b44.zip
- chicken: disable selling
- menu: fix 80-width titles - bbslua: return empty string instead of nil for getdata() git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3820 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbslua.c4
-rw-r--r--mbbsd/chicken.c69
-rw-r--r--mbbsd/menu.c4
3 files changed, 6 insertions, 71 deletions
diff --git a/mbbsd/bbslua.c b/mbbsd/bbslua.c
index 5e88bc7c..76b01451 100644
--- a/mbbsd/bbslua.c
+++ b/mbbsd/bbslua.c
@@ -330,12 +330,14 @@ bl_getstr(lua_State* L)
abortBBSLua = 1;
return lua_yield(L, 0);
}
+ lua_pushstring(L, "");
}
else
{
lua_pushstring(L, buf);
}
- return len ? 1 : 0;
+ // return len ? 1 : 0;
+ return 1;
}
BLAPI_PROTO
diff --git a/mbbsd/chicken.c b/mbbsd/chicken.c
index a9c8b01b..7f0ab9c4 100644
--- a/mbbsd/chicken.c
+++ b/mbbsd/chicken.c
@@ -441,69 +441,6 @@ ch_kill(void)
}
}
-static int
-ch_sell(int age)
-{
- chicken_t *mychicken = &cuser.mychicken;
- /*
- * int money = (mychicken->weight -
- * time_change[(int)mychicken->type][WEIGHT])
- * (food_price[(int)mychicken->type])/4 + ( + ((mychicken->clean /
- * time_change[(int)mychicken->type][CLEAN]) + (mychicken->run /
- * time_change[(int)mychicken->type][RUN]) + (mychicken->attack /
- * time_change[(int)mychicken->type][ATTACK]) + (mychicken->book /
- * time_change[(int)mychicken->type][BOOK]) + (mychicken->happy /
- * time_change[(int)mychicken->type][HAPPY]) + (mychicken->satis /
- * time_change[(int)mychicken->type][SATIS]) + (mychicken->temperament /
- * time_change[(int)mychicken->type][TEMPERAMENT]) -
- * (mychicken->tiredstrong /
- * time_change[(int)mychicken->type][TIREDSTRONG]) - (mychicken->sick /
- * time_change[(int)mychicken->type][SICK]) + (mychicken->hp /
- * time_change[(int)mychicken->type][HP_MAX]) + (mychicken->mm /
- * time_change[(int)mychicken->type][MM_MAX]) + 7 - abs(age - 7)) * 3 ;
- */
- int money = (age * food_price[(int)mychicken->type] * 3
- + (mychicken->hp_max * 10 + mychicken->weight) /
- time_change[(int)mychicken->type][HP_MAX]) * 3 / 2 -
- mychicken->sick, ans;
-
- if (money < 0)
- money = 0;
- else if (money > MAX_CHICKEN_MONEY)
- money = MAX_CHICKEN_MONEY;
- //防止怪雞
- if (mychicken->type == 1 || mychicken->type == 7) {
- outs("\n" ANSI_COLOR(31) " ㄜ..親愛的..販賣人口是會犯法的唷.." ANSI_RESET);
- pressanykey();
- return 0;
- }
- if (age < 5) {
- outs("\n 還未成年不能賣");
- pressanykey();
- return 0;
- }
- if (age > 30) {
- outs("\n" ANSI_COLOR(31) " 這..太老沒人要了" ANSI_RESET);
- pressanykey();
- return 0;
- }
- ans = getans("這隻%d歲%s可以賣 %d 元, 是否要賣?(y/N)", age,
- chicken_type[(int)mychicken->type], money);
- if (ans == 'y') {
- log_filef(CHICKENLOG, LOG_CREAT,
- ANSI_COLOR(31) "%s" ANSI_RESET " 把 " ANSI_COLOR(33) "%s" ANSI_RESET " "
- ANSI_COLOR(32) "%s" ANSI_RESET " 用 " ANSI_COLOR(36) "%d" ANSI_RESET " 賣了 於 %s\n",
- cuser.userid, mychicken->name,
- chicken_type[(int)mychicken->type], money, ctime4(&now));
- mychicken->lastvisit = mychicken->name[0] = 0;
- passwd_update(usernum, &cuser);
- more(CHICKEN_PIC "/sell", YEA);
- demoney(money);
- return 1;
- }
- return 0;
-}
-
static void
geting_old(int *hp, int *weight, int diff, int age)
{
@@ -728,7 +665,7 @@ select_menu(int age)
"(" ANSI_COLOR(37) "7" ANSI_COLOR(33) ")買%s$%d (" ANSI_COLOR(37) "8" ANSI_COLOR(33) ")吃補丸\n"
"(" ANSI_COLOR(37) "9" ANSI_COLOR(33) ")吃病藥 (" ANSI_COLOR(37) "o" ANSI_COLOR(33) ")買大補丸$100 "
"(" ANSI_COLOR(37) "m" ANSI_COLOR(33) ")買藥$10 (" ANSI_COLOR(37) "k" ANSI_COLOR(33) ")棄養 "
- "(" ANSI_COLOR(37) "s" ANSI_COLOR(33) ")賣掉 (" ANSI_COLOR(37) "n" ANSI_COLOR(33) ")改名 "
+ "(" ANSI_COLOR(37) "n" ANSI_COLOR(33) ")改名 "
"(" ANSI_COLOR(37) "q" ANSI_COLOR(33) ")離開:" ANSI_RESET,
cuser.money,
/*
@@ -789,10 +726,6 @@ select_menu(int age)
case 'k':
ch_kill();
return 0;
- case 'S':
- case 's':
- if (!ch_sell(age))
- break;
case 'Q':
case 'q':
return 0;
diff --git a/mbbsd/menu.c b/mbbsd/menu.c
index e9ee4dfe..49c0dab4 100644
--- a/mbbsd/menu.c
+++ b/mbbsd/menu.c
@@ -88,7 +88,7 @@ showtitle(const char *title, const char *mid)
/* now, calculate real positioning info */
if(llen < 0) llen = strlen(title);
if(mlen < 0) mlen = strlen(mid);
- mpos = (t_columns - mlen)/2;
+ mpos = (t_columns -1 - mlen)/2;
/* first, print left. */
clear();
@@ -104,7 +104,7 @@ showtitle(const char *title, const char *mid)
outs(TITLE_COLOR);
/* try to locate right */
rlen = strlen(currboard) + 4 + 4;
- if(currboard[0] && pos+rlen <= t_columns)
+ if(currboard[0] && pos+rlen < t_columns)
{
// print right stuff
while(++pos < t_columns-rlen)