summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mbbsd/gamble.c11
-rw-r--r--mbbsd/gomo.c21
2 files changed, 17 insertions, 15 deletions
diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c
index ed4cb724..d9b3ea2b 100644
--- a/mbbsd/gamble.c
+++ b/mbbsd/gamble.c
@@ -1,4 +1,4 @@
-/* $Id: gamble.c,v 1.30 2003/01/16 13:28:48 kcwu Exp $ */
+/* $Id: gamble.c,v 1.31 2003/01/16 14:14:12 kcwu Exp $ */
#include "bbs.h"
#ifndef _BBS_UTIL_C_
@@ -6,7 +6,6 @@
#define MAX_ITEM_LEN 30 //最大 每一賭項名字長度
#define MAX_SUBJECT_LEN 650 //8*81 = 648 最大 主題長度
-static char betname[MAX_ITEM][MAX_ITEM_LEN];
static int currbid;
static int
@@ -25,7 +24,7 @@ load_ticket_record(char *direct, int ticket[])
}
static int
-show_ticket_data(char *direct, int *price, boardheader_t * bh)
+show_ticket_data(char betname[MAX_ITEM][MAX_ITEM_LEN],char *direct, int *price, boardheader_t * bh)
{
int i, count, total = 0, end = 0, ticket[MAX_ITEM] = {0, 0, 0, 0, 0, 0, 0, 0};
FILE *fp;
@@ -121,6 +120,7 @@ ticket(int bid)
{
int ch, n, price, count, end = 0;
char path[128], fn_ticket[128];
+ char betname[MAX_ITEM][MAX_ITEM_LEN];
boardheader_t *bh = NULL;
if (bid) {
@@ -133,7 +133,7 @@ ticket(int bid)
lockreturn0(TICKET, LOCK_MULTI);
while (1) {
- count = show_ticket_data(path, &price, bh);
+ count = show_ticket_data(betname, path, &price, bh);
if (count <= 0) {
pressanykey();
break;
@@ -177,9 +177,10 @@ openticket(int bid)
int i, money = 0, count, bet, price, total = 0, ticket[8] = {0, 0, 0, 0, 0, 0, 0, 0};
boardheader_t *bh = getbcache(bid);
FILE *fp, *fp1;
+ char betname[MAX_ITEM][MAX_ITEM_LEN];
setbpath(path, bh->brdname);
- count = -show_ticket_data(path, &price, bh);
+ count = -show_ticket_data(betname, path, &price, bh);
if (count == 0) {
setbfile(buf, bh->brdname, FN_TICKET_END);
unlink(buf);
diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c
index bf9c9b97..b7665bae 100644
--- a/mbbsd/gomo.c
+++ b/mbbsd/gomo.c
@@ -1,4 +1,4 @@
-/* $Id: gomo.c,v 1.10 2003/01/16 13:52:25 kcwu Exp $ */
+/* $Id: gomo.c,v 1.11 2003/01/16 14:14:12 kcwu Exp $ */
#include "bbs.h"
static char *chess[] = {"●", "○"};
@@ -9,12 +9,12 @@ typedef struct {
char y;
} Horder_t;
-static Horder_t *v, pool[225];
+static Horder_t *v;
static void
-HO_init()
+HO_init(Horder_t *pool)
{
- memset(pool, 0, sizeof(pool));
+ memset(pool, 0, sizeof(Horder_t)*BRDSIZ*BRDSIZ);
v = pool;
pat = pat_gomoku;
adv = adv_gomoku;
@@ -43,7 +43,7 @@ HO_undo(Horder_t * mv)
}
static void
-HO_log(char *user)
+HO_log(Horder_t *pool, char *user)
{
int i;
FILE *log;
@@ -83,7 +83,7 @@ HO_log(char *user)
}
static int
-countgomo()
+countgomo(Horder_t *pool)
{
return v-pool;
}
@@ -166,8 +166,9 @@ gomoku(int fd)
int me, he, win, ch;
int hewantpass, iwantpass;
userinfo_t *my = currutmp;
+ Horder_t pool[BRDSIZ*BRDSIZ];
- HO_init();
+ HO_init(pool);
me = !(my->turn) + 1;
he = my->turn + 1;
win = 1;
@@ -247,7 +248,7 @@ gomoku(int fd)
if (ch != I_OTHERDATA)
iwantpass = 0;
if (ch == 'q') {
- if (countgomo() < 10) {
+ if (countgomo(pool) < 10) {
cuser.five_lose--;
passwd_update(usernum, &cuser);
}
@@ -292,7 +293,7 @@ gomoku(int fd)
if (lastcount >= 0) {
win = 1;
cuser.five_lose--;
- if (countgomo() >= 10) {
+ if (countgomo(pool) >= 10) {
cuser.five_win++;
my->five_win++;
}
@@ -394,7 +395,7 @@ gomoku(int fd)
getdata(19, 0, "要保留本局成棋譜嗎?(y/N)", ans, sizeof(ans), LCECHO);
if (*ans == 'y')
- HO_log(my->mateid);
+ HO_log(pool, my->mateid);
}
return 0;
}