summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-07-24 15:08:26 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-07-24 15:08:26 +0000
commit615ab00413276480f42f87a9947841221905d6af (patch)
tree8e6219bae5016288a30621b2999a60c3503cee17
parentf4ba88981125e359603a51a46a6f1666e2cb7f53 (diff)
Clean up play, let player see play more often, improve display timing.
Preliminary work from PR 2055 (as reverse patches); phil
-rw-r--r--games/cribbage/crib.c18
-rw-r--r--games/cribbage/instr.c8
-rw-r--r--games/cribbage/io.c4
-rw-r--r--games/cribbage/support.c4
4 files changed, 24 insertions, 10 deletions
diff --git a/games/cribbage/crib.c b/games/cribbage/crib.c
index f6e86e78275..3cf1f74c3dd 100644
--- a/games/cribbage/crib.c
+++ b/games/cribbage/crib.c
@@ -1,4 +1,4 @@
-/* $NetBSD: crib.c,v 1.5 1995/03/21 15:08:42 cgd Exp $ */
+/* $NetBSD: crib.c,v 1.7 1997/07/10 06:47:29 mikel Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)crib.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: crib.c,v 1.5 1995/03/21 15:08:42 cgd Exp $";
+static char rcsid[] = "$NetBSD: crib.c,v 1.7 1997/07/10 06:47:29 mikel Exp $";
#endif
#endif /* not lint */
@@ -132,7 +132,7 @@ main(argc, argv)
} while (playing);
setegid(egid);
- if (f = fopen(_PATH_LOG, "a")) {
+ if ((f = fopen(_PATH_LOG, "a")) != NULL) {
(void)fprintf(f, "%s: won %5.5d, lost %5.5d\n",
getlogin(), cgames, pgames);
(void) fclose(f);
@@ -233,10 +233,13 @@ game()
} else
compcrib = (deck[i].rank > deck[j].rank);
} while (flag);
+ do_wait();
clear();
makeboard();
refresh();
} else {
+ makeboard();
+ refresh();
werase(Tablewin);
wrefresh(Tablewin);
werase(Compwin);
@@ -294,6 +297,9 @@ playhand(mycrib)
register int deckpos;
werase(Compwin);
+ wrefresh(Compwin);
+ werase(Tablewin);
+ wrefresh(Tablewin);
knownum = 0;
deckpos = deal(mycrib);
@@ -434,6 +440,7 @@ prcrib(mycrib, blank)
for (y = CRIB_Y; y <= CRIB_Y + 5; y++)
mvaddstr(y, cardx, " ");
+ refresh();
}
/*
@@ -480,6 +487,7 @@ peg(mycrib)
else { /* give him his point */
msg(quiet ? "You get one" :
"You get one point");
+ do_wait();
if (chkscr(&pscore, 1))
return TRUE;
sum = 0;
@@ -557,6 +565,8 @@ peg(mycrib)
if (i > 0) {
msg(quiet ? "You got %d" :
"You got %d points", i);
+ if (pnum == 0)
+ do_wait();
if (chkscr(&pscore, i))
return TRUE;
}
@@ -587,6 +597,7 @@ peg(mycrib)
} else {
msg(quiet ? "You get one for last" :
"You get one point for last");
+ do_wait();
if (chkscr(&pscore, 1))
return TRUE;
}
@@ -623,6 +634,7 @@ score(mycrib)
do_wait();
if (comphand(crib, "crib"))
return (TRUE);
+ do_wait();
} else {
if (comphand(chand, "hand"))
return (TRUE);
diff --git a/games/cribbage/instr.c b/games/cribbage/instr.c
index 39209440245..83a41948808 100644
--- a/games/cribbage/instr.c
+++ b/games/cribbage/instr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: instr.c,v 1.4 1996/02/06 22:47:18 jtc Exp $ */
+/* $NetBSD: instr.c,v 1.5 1997/07/10 06:47:30 mikel Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)instr.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$NetBSD: instr.c,v 1.4 1996/02/06 22:47:18 jtc Exp $";
+static char rcsid[] = "$NetBSD: instr.c,v 1.5 1997/07/10 06:47:30 mikel Exp $";
#endif
#endif /* not lint */
@@ -76,10 +76,10 @@ instructions()
case 0:
if (!(path = getenv("PAGER")))
path = _PATH_MORE;
- if (pager = strrchr(path, '/'))
+ if ((pager = strrchr(path, '/')))
++pager;
pager = path;
- execlp(path, pager, _PATH_INSTR, (char *)NULL);
+ execlp(path, pager, _PATH_INSTR, NULL);
(void)fprintf(stderr, "cribbage: %s.\n", strerror(errno));
_exit(1);
default:
diff --git a/games/cribbage/io.c b/games/cribbage/io.c
index bdc2d35c79c..c4bcbaa3f8d 100644
--- a/games/cribbage/io.c
+++ b/games/cribbage/io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.7 1995/03/21 15:08:53 cgd Exp $ */
+/* $NetBSD: io.c,v 1.9 1997/07/09 06:25:47 phil Exp $ */
/*-
* Copyright (c) 1980, 1993
@@ -407,6 +407,7 @@ msg(fmt, va_alist)
va_start(ap);
#endif
(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
+ Newpos = strlen(Msgbuf);
va_end(ap);
endmsg();
}
@@ -432,6 +433,7 @@ addmsg(fmt, va_alist)
va_start(ap);
#endif
(void)vsprintf(&Msgbuf[Newpos], fmt, ap);
+ Newpos = strlen(Msgbuf);
va_end(ap);
}
diff --git a/games/cribbage/support.c b/games/cribbage/support.c
index a2064a213b7..53bdaf7373d 100644
--- a/games/cribbage/support.c
+++ b/games/cribbage/support.c
@@ -190,8 +190,8 @@ chkscr(scr, inc)
myturn = (scr == &cscore);
if (inc != 0) {
- prpeg(Lastscore[myturn], '.', myturn);
- Lastscore[myturn] = *scr;
+ prpeg(Lastscore[(int)myturn], '.', myturn);
+ Lastscore[(int)myturn] = *scr;
*scr += inc;
prpeg(*scr, PEG, myturn);
refresh();