summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-10-21 22:15:16 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-10-21 22:15:16 +0800
commit1c5a0fc6fa4328436c2737d7ebc6f84f875c5a10 (patch)
treed713908a638401946e95db1147af94050386b412
parent394d32d7d1cc0d95a737e9c027e6f0c6d8834a8d (diff)
downloadpttbbs-1c5a0fc6fa4328436c2737d7ebc6f84f875c5a10.tar
pttbbs-1c5a0fc6fa4328436c2737d7ebc6f84f875c5a10.tar.gz
pttbbs-1c5a0fc6fa4328436c2737d7ebc6f84f875c5a10.tar.bz2
pttbbs-1c5a0fc6fa4328436c2737d7ebc6f84f875c5a10.tar.lz
pttbbs-1c5a0fc6fa4328436c2737d7ebc6f84f875c5a10.tar.xz
pttbbs-1c5a0fc6fa4328436c2737d7ebc6f84f875c5a10.tar.zst
pttbbs-1c5a0fc6fa4328436c2737d7ebc6f84f875c5a10.zip
fix card_jack crash
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2272 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/card.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/mbbsd/card.c b/mbbsd/card.c
index 6e9a63ed..7a3178e1 100644
--- a/mbbsd/card.c
+++ b/mbbsd/card.c
@@ -498,8 +498,8 @@ card_jack(int *db)
}
j = 2;
c[0] = 1;
- while ((card_alls_upper(cpu) < card_alls_upper(me)) ||
- ((card_alls_upper(cpu) == card_alls_upper(me) && j < i) && j < 5)) {
+ while ((card_alls_upper(cpu) < card_alls_upper(me) ||
+ (card_alls_upper(cpu) == card_alls_upper(me) && j < i)) && j < 5) {
cpu[j] = card_give(cards);
c[j] = 1;
if (card_alls_lower(cpu) > 21) {
@@ -511,6 +511,16 @@ card_jack(int *db)
j++;
}
card_show(cpu, c, me, m);
+ if(card_alls_upper(cpu)==card_alls_upper(me)) {
+ game_log(JACK, JACK);
+ vmsg("平局,退回P幣 %d 元!", JACK);
+ return 0;
+ }
+ if(card_alls_upper(cpu)<card_alls_upper(me)) {
+ game_log(JACK, JACK * 2);
+ vmsg("呵呵...電腦比較小! 你贏了! 可得P幣 %d 元", JACK * 2);
+ return 0;
+ }
game_log(JACK, 0);
vmsg("哇哇...電腦贏了!");
return 0;