diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-30 23:49:21 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2008-05-30 23:49:21 +0800 |
commit | fcb8968ae905a84c8956fced725eb89854bb6c5b (patch) | |
tree | 58e68b3fa3b87582a7b3c5c101afb2dc1aff39ce /mbbsd/gamble.c | |
parent | 5f7d21d9ab7d9d7bc246e9c9ede9ff35d07353cf (diff) | |
download | pttbbs-fcb8968ae905a84c8956fced725eb89854bb6c5b.tar pttbbs-fcb8968ae905a84c8956fced725eb89854bb6c5b.tar.gz pttbbs-fcb8968ae905a84c8956fced725eb89854bb6c5b.tar.bz2 pttbbs-fcb8968ae905a84c8956fced725eb89854bb6c5b.tar.lz pttbbs-fcb8968ae905a84c8956fced725eb89854bb6c5b.tar.xz pttbbs-fcb8968ae905a84c8956fced725eb89854bb6c5b.tar.zst pttbbs-fcb8968ae905a84c8956fced725eb89854bb6c5b.zip |
- prevent sharing buy_ticket for chicken and gamble
- prompt user gamble type choice
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4330 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/gamble.c')
-rw-r--r-- | mbbsd/gamble.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c index 4738b005..81310988 100644 --- a/mbbsd/gamble.c +++ b/mbbsd/gamble.c @@ -137,6 +137,36 @@ append_ticket_record(const char *direct, int ch, int n, int count) return 0; } +void +buy_ticket_ui(int money, const char *picture, int *item, int haveticket) +{ + int num = 0; + char buf[5]; + + // XXX defaults to 1? + getdata_str(b_lines - 1, 0, "要買多少份呢:", + buf, sizeof(buf), NUMECHO, "1"); + num = atoi(buf); + if (num < 1) + return; + + reload_money(); + if (cuser.money/money <= num) { + vmsg("現金不夠 !!!"); + return; + } + + *item += num; + if( haveticket ) + vice(money * num, "賭盤項目"); + else + demoney(-money * num); + // XXX magic numbers 5, 14... + show_file(picture, 5, 14, SHOWFILE_ALLOW_ALL); + pressanykey(); + usleep(100000); // sleep 0.1s +} + #define lockreturn0(unmode, state) if(lockutmpmode(unmode, state)) return 0 int ticket(int bid) @@ -177,11 +207,13 @@ ticket(int bid) --*/ if (ch == 'q' || ch == 'Q') break; + outc(ch); ch -= '1'; if (end || ch >= count || ch < 0) continue; n = 0; - ch_buyitem(price, "etc/buyticket", &n, 0); + + buy_ticket_ui(price, "etc/buyticket", &n, 0); if (bid && !dashf(fn_ticket)) goto doesnt_catch_up; |