diff options
author | jdc <jdc@NetBSD.org> | 2004-04-06 19:15:07 +0000 |
---|---|---|
committer | jdc <jdc@NetBSD.org> | 2004-04-06 19:15:07 +0000 |
commit | acc53772d30828b53555695b5a70ddc4b7149ee0 (patch) | |
tree | f9e2ab43a3bc2a52adbb0cea19021628e0657377 /mille/move.c | |
parent | c00256da127a9e681c12e436fca8476bcf3b4aba (diff) | |
download | bsdgames-darwin-acc53772d30828b53555695b5a70ddc4b7149ee0.tar.gz bsdgames-darwin-acc53772d30828b53555695b5a70ddc4b7149ee0.tar.zst bsdgames-darwin-acc53772d30828b53555695b5a70ddc4b7149ee0.zip |
If the current player has no cards, skip to the other player.
While we're here, make this compile with -DDEBUG.
Fixes PR bin/12530 from Thomas Klausner.
Diffstat (limited to 'mille/move.c')
-rw-r--r-- | mille/move.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/mille/move.c b/mille/move.c index 1cfa7a0e..caca78c1 100644 --- a/mille/move.c +++ b/mille/move.c @@ -1,4 +1,4 @@ -/* $NetBSD: move.c,v 1.13 2003/08/07 09:37:25 agc Exp $ */ +/* $NetBSD: move.c,v 1.14 2004/04/06 19:15:07 jdc Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,12 +34,16 @@ #if 0 static char sccsid[] = "@(#)move.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: move.c,v 1.13 2003/08/07 09:37:25 agc Exp $"); +__RCSID("$NetBSD: move.c,v 1.14 2004/04/06 19:15:07 jdc Exp $"); #endif #endif /* not lint */ #include <termios.h> +#ifdef DEBUG +#include <sys/param.h> +#endif + #include "mille.h" #ifndef unctrl #include "unctrl.h" @@ -60,6 +64,13 @@ domove() bool goodplay; pp = &Player[Play]; + for (i = 0, j = 0; i < HAND_SZ; i++) + if (pp->hand[i] != -1) + j++; + if (!j) { + nextplay(); + return; + } if (Play == PLAYER) getmove(); else @@ -426,10 +437,12 @@ getmove() case 'Z': /* Debug code */ if (!Debug && outf == NULL) { char buf[MAXPATHLEN]; + char *sp; prompt(FILEPROMPT); leaveok(Board, FALSE); refresh(); +over: sp = buf; while ((*sp = readch()) != '\n') { if (*sp == killchar()) |