summaryrefslogtreecommitdiffstats
path: root/mbbsd/gomo.c
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-13 11:20:04 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-05-13 11:20:04 +0800
commit6a428fb60d8ec6092d428b2e0f869a31f4890dc7 (patch)
treea0671ea2dc0168a9cb5625f867d553f6d0441efc /mbbsd/gomo.c
parent438c456b95eec0e5ac662ca3cf2386dff2c44bc7 (diff)
downloadpttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.gz
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.bz2
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.lz
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.xz
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.tar.zst
pttbbs-6a428fb60d8ec6092d428b2e0f869a31f4890dc7.zip
replace time(NULL) by now
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@163 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/gomo.c')
-rw-r--r--mbbsd/gomo.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/mbbsd/gomo.c b/mbbsd/gomo.c
index 41650c77..190d6f71 100644
--- a/mbbsd/gomo.c
+++ b/mbbsd/gomo.c
@@ -1,4 +1,4 @@
-/* $Id: gomo.c,v 1.2 2002/04/28 19:35:29 in2 Exp $ */
+/* $Id: gomo.c,v 1.3 2002/05/13 03:20:04 ptt Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -15,6 +15,7 @@
extern int usernum;
extern userinfo_t *currutmp;
+extern time_t now;
char ku[BRDSIZ][BRDSIZ];
static char *chess[] = { "●", "○" };
@@ -185,7 +186,7 @@ int gomoku(int fd) {
me = !(my->turn) + 1;
he = my->turn + 1;
win = 1;
- tick=time(0) + MAX_TIME;
+ tick=now + MAX_TIME;
lastcount = MAX_TIME;
setutmpmode(M_FIVE);
clear();
@@ -224,8 +225,8 @@ int gomoku(int fd) {
for(;;) {
move(13, 40);
outs(my->turn ? "輪到自己下了!": "等待對方下子..");
- if(lastcount != tick-time(0)) {
- lastcount = tick-time(0);
+ if(lastcount != tick-now) {
+ lastcount = tick-now;
move(18, 40);
prints("%s時間還剩%d:%02d\n", my->turn ? "你的" : "對方",
lastcount / 60, lastcount % 60);
@@ -303,7 +304,7 @@ int gomoku(int fd) {
if(ch == I_OTHERDATA) {
ch = recv(fd, &mv, sizeof(Horder_t), 0);
if(ch != sizeof(Horder_t)) {
- lastcount=tick-time(0);
+ lastcount=tick-now;
if(lastcount >=0) {
win = 1;
cuser.five_lose--;
@@ -346,7 +347,7 @@ int gomoku(int fd) {
win = chkmv(&mv, he, he == BBLACK);
HO_add(&mv);
hislasttick = tick;
- tick = time(0) + MAX_TIME;
+ tick = now + MAX_TIME;
ku[(int)mv.x][(int)mv.y] = he;
bell();
BGOTO(mv.x, mv.y);
@@ -382,7 +383,7 @@ int gomoku(int fd) {
win = chkmv( &mv, me, me == BBLACK);
ku[(int)mv.x][(int)mv.y] = me;
mylasttick = tick;
- tick = time(0) + MAX_TIME; /*倒數*/
+ tick = now + MAX_TIME; /*倒數*/
lastcount = MAX_TIME;
if(send(fd, &mv, sizeof(Horder_t), 0) != sizeof(Horder_t))
break;