summaryrefslogtreecommitdiffstats
path: root/mbbsd/gomo.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-01-16 22:14:12 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-01-16 22:14:12 +0800
commit169cf5d08f377d095f133495e0577dcd8698cb25 (patch)
tree5c09b031be1672ae020f5d23d816fd2ee65d4771 /mbbsd/gomo.c
parent0ade0762a9549675b63ba71e671d851679c480d0 (diff)
downloadpttbbs-169cf5d08f377d095f133495e0577dcd8698cb25.tar
pttbbs-169cf5d08f377d095f133495e0577dcd8698cb25.tar.gz
pttbbs-169cf5d08f377d095f133495e0577dcd8698cb25.tar.bz2
pttbbs-169cf5d08f377d095f133495e0577dcd8698cb25.tar.lz
pttbbs-169cf5d08f377d095f133495e0577dcd8698cb25.tar.xz
pttbbs-169cf5d08f377d095f133495e0577dcd8698cb25.tar.zst
pttbbs-169cf5d08f377d095f133495e0577dcd8698cb25.zip
move global array into local.
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@611 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/gomo.c')
-rw-r--r--mbbsd/gomo.c21
1 files changed, 11 insertions, 10 deletions
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;
}