summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-08-04 21:12:29 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2010-08-04 21:12:29 +0800
commit029893ebe151032b5ffb5fcb223bfe55fc4b328e (patch)
tree00542b6f919bb1a909132c54cdadf5e36ccbddfd
parent19dd0c8429199516b0c230829b268f3634b01050 (diff)
downloadpttbbs-029893ebe151032b5ffb5fcb223bfe55fc4b328e.tar
pttbbs-029893ebe151032b5ffb5fcb223bfe55fc4b328e.tar.gz
pttbbs-029893ebe151032b5ffb5fcb223bfe55fc4b328e.tar.bz2
pttbbs-029893ebe151032b5ffb5fcb223bfe55fc4b328e.tar.lz
pttbbs-029893ebe151032b5ffb5fcb223bfe55fc4b328e.tar.xz
pttbbs-029893ebe151032b5ffb5fcb223bfe55fc4b328e.tar.zst
pttbbs-029893ebe151032b5ffb5fcb223bfe55fc4b328e.zip
time to say goodbye to vice
git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5093 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/include/proto.h3
-rw-r--r--pttbbs/mbbsd/Makefile2
-rw-r--r--pttbbs/mbbsd/menu.c13
-rw-r--r--pttbbs/mbbsd/vice.c153
4 files changed, 7 insertions, 164 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index 3315a3bc..0a59702e 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -672,9 +672,6 @@ int b_vote(void);
int b_vote_maintain(void);
void auto_close_polls(void);
-/* vice */
-int vice_main(void);
-
/* voteboard */
int do_voteboard(int);
void do_voteboardreply(const fileheader_t *fhdr);
diff --git a/pttbbs/mbbsd/Makefile b/pttbbs/mbbsd/Makefile
index 7726635a..6b7b0beb 100644
--- a/pttbbs/mbbsd/Makefile
+++ b/pttbbs/mbbsd/Makefile
@@ -14,7 +14,7 @@ NETOBJS = mbbsd.o io.o term.o telnet.o
TALKOBJS = friend.o talk.o ccw.o
UTILOBJS = stuff.o kaede.o convert.o name.o syspost.o
PAGEROBJS= more.o pmore.o
-PLUGOBJS = calendar.o ordersong.o gamble.o vice.o angel.o
+PLUGOBJS = calendar.o ordersong.o gamble.o angel.o
CHESSOBJS= chess.o chc.o chc_tab.o ch_go.o ch_gomo.o ch_dark.o ch_reversi.o
GAMEOBJS = card.o chicken.o
OBJS:= admin.o assess.o edit.o menu.o xyz.o var.o vtuikit.o \
diff --git a/pttbbs/mbbsd/menu.c b/pttbbs/mbbsd/menu.c
index 40f07284..0c81d155 100644
--- a/pttbbs/mbbsd/menu.c
+++ b/pttbbs/mbbsd/menu.c
@@ -821,9 +821,9 @@ static const commands_t xyzlist[] = {
static const commands_t moneylist[] = {
{p_give, 0, "00Give 給其他人錢"},
{save_violatelaw, 0,"11ViolateLaw 繳罰單"},
- {p_from, 0, "33From 暫時修改故鄉"},
- {ordersong,0, "44OSong 動態點歌機"},
- {p_exmail, 0, "55Exmail 購買信箱 $1000/封"},
+ {p_from, 0, "22From 暫時修改故鄉"},
+ {ordersong,0, "33OSong 動態點歌機"},
+ {p_exmail, 0, "44Exmail 購買信箱 $1000/封"},
{NULL, 0, NULL}
};
@@ -899,10 +899,9 @@ static int chessroom() {
static const commands_t plist[] = {
{ticket_main, PERM_LOGINOK, "11Gamble 【 " BBSMNAME2 "賭場 】"},
- {vice_main, PERM_LOGINOK, "22Vice 【 發票對獎 】"},
- {g_card_jack, PERM_LOGINOK, "33Jack 【 黑傑克 】"},
- {g_ten_helf, PERM_LOGINOK, "44Tenhalf 【 十點半 】"},
- {card_99, PERM_LOGINOK, "55Nine 【 九十九 】"},
+ {g_card_jack, PERM_LOGINOK, "22Jack 【 黑傑克 】"},
+ {g_ten_helf, PERM_LOGINOK, "33Tenhalf 【 十點半 】"},
+ {card_99, PERM_LOGINOK, "44Nine 【 九十九 】"},
{NULL, 0, NULL}
};
diff --git a/pttbbs/mbbsd/vice.c b/pttbbs/mbbsd/vice.c
deleted file mode 100644
index 14e4e8f4..00000000
--- a/pttbbs/mbbsd/vice.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $Id$ */
-#include "bbs.h"
-
-#define VICE_PLAY BBSHOME "/etc/vice/vice.play"
-#define VICE_DATA "vice.new"
-#define VICE_BINGO BBSHOME "/etc/vice.bingo"
-#define VICE_SHOW BBSHOME "/etc/vice.show"
-#define VICE_LOST BBSHOME "/etc/vice/vice.lost"
-#define VICE_WIN BBSHOME "/etc/vice/vice.win"
-#define VICE_END BBSHOME "/etc/vice/vice.end"
-#define VICE_NO BBSHOME "/etc/vice/vice.no"
-#define MAX_NO_PICTURE 2
-#define MAX_WIN_PICTURE 2
-#define MAX_LOST_PICTURE 3
-#define MAX_END_PICTURE 5
-
-static int
-vice_load(char tbingo[6][15])
-{
- FILE *fb = fopen(VICE_BINGO, "r");
- char buf[16], *ptr;
- int i = 0;
- if (!fb)
- return -1;
- bzero((char *)tbingo, 6*15);
- while (i < 6 && fgets(buf, 15, fb)) {
- if ((ptr = strchr(buf, '\n')))
- *ptr = 0;
- strcpy(tbingo[i++], buf);
- }
- fclose(fb);
- return 0;
-}
-
-static int
-check(char tbingo[6][15], const char *data)
-{
- int i = 0, j;
-
- if (!strcmp(data, tbingo[0]))
- return 8;
-
- for (j = 8; j > 0; j--)
- for (i = 1; i < 6; i++)
- if (!strncmp(data + 8 - j, tbingo[i] + 8 - j, j))
- return j - 1;
- return 0;
-}
-/* TODO Ptt:showfile ran_showfile more 三者要合 */
-static int
-ran_showfile(int y, int x, const char *filename, int maxnum)
-{
- FILE *fs;
- char buf[512];
-
- bzero(buf, sizeof(buf));
- snprintf(buf, sizeof(buf), "%s%d", filename, (int)(random() % maxnum + 1));
- if (!(fs = fopen(buf, "r"))) {
- move(10, 10);
- prints("can't open file: %s", buf);
- return 0;
- }
- move(y, x);
-
- while (fgets(buf, sizeof(buf), fs))
- outs(buf);
-
- fclose(fs);
- return 1;
-}
-
-static int
-ran_showmfile(const char *filename, int maxnum)
-{
- char buf[256];
-
- snprintf(buf, sizeof(buf), "%s%d", filename, (int)(random() % maxnum + 1));
- return more(buf, YEA);
-}
-
-
-int
-vice_main(void)
-{
- FILE *fd;
- char tbingo[6][15];
- char buf_data[256],
- serial[16], ch[2], *ptr;
- int TABLE[] = {0, 10, 200, 1000, 4000, 10000, 40000, 100000, 200000};
- int total = 0, money, i = 4, j = 0;
-
- setuserfile(buf_data, VICE_DATA);
- if (!dashf(buf_data)) {
- ran_showmfile(VICE_NO, MAX_NO_PICTURE);
- return 0;
- }
- if (vice_load(tbingo) < 0)
- return -1;
- clear();
- ran_showfile(0, 0, VICE_PLAY, 1);
- ran_showfile(10, 0, VICE_SHOW, 1);
-
- if (!(fd = fopen(buf_data, "r")))
- return 0;
- j = 0;
- i = 0;
- move(10, 24);
- clrtoeol();
- outs("這一期的發票號碼");
- // FIXME 當發票多於一行, 開獎的號碼就會被蓋掉
- while (fgets(serial, 15, fd)) {
- if ((ptr = strchr(serial, '\r')))
- *ptr = 0;
- if (j == 0)
- i++;
- if( i >= 14 )
- break;
- move(10 + i, 24 + j);
- outs(serial);
- j += 9;
- j %= 45;
- }
- getdata(8, 0, "按'c'開始對獎了(或是任意鍵離開)): ",
- ch, sizeof(ch), LCECHO);
- if (ch[0] != 'c' || lockutmpmode(VICE, LOCK_MULTI)) {
- fclose(fd);
- return 0;
- }
- showtitle("發票對獎", BBSNAME);
- rewind(fd);
- while (fgets(serial, 15, fd)) {
- if ((ptr = strchr(serial, '\n')))
- *ptr = 0;
- money = TABLE[check(tbingo, serial)];
- total += money;
- prints("%s 中了 %d\n", serial, money);
- }
- pressanykey();
- if (total > 0) {
- ran_showmfile(VICE_WIN, MAX_WIN_PICTURE);
- move(22, 0);
- clrtoeol();
- prints("全部的發票中了 %d 塊錢\n", total);
- demoney(total);
- } else
- ran_showmfile(VICE_LOST, MAX_LOST_PICTURE);
-
- fclose(fd);
- unlink(buf_data);
- pressanykey();
- unlockutmpmode();
- return 0;
-}