summaryrefslogtreecommitdiffstats
path: root/fish/fish.c
diff options
context:
space:
mode:
authoreadler <eadler@NetBSD.org>2018-03-05 04:59:54 +0000
committereadler <eadler@NetBSD.org>2018-03-05 04:59:54 +0000
commit63290a3c03c4c703674a7415e331e8960a74ad51 (patch)
treecf3dae74ca14fab67a8f404d3197ef0c2a6da848 /fish/fish.c
parent85d07d2f45891e1e7083fcaca221a56c35f1773d (diff)
downloadbsdgames-darwin-63290a3c03c4c703674a7415e331e8960a74ad51.tar.gz
bsdgames-darwin-63290a3c03c4c703674a7415e331e8960a74ad51.zip
[fish] don't allow users to request cards they have made books for
While here, don't re-renter pro mode PR bin/52973 ok maya@ dh@
Diffstat (limited to 'fish/fish.c')
-rw-r--r--fish/fish.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/fish/fish.c b/fish/fish.c
index c7c342ab..78e2dc52 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fish.c,v 1.22 2011/09/01 07:18:50 plunky Exp $ */
+/* $NetBSD: fish.c,v 1.23 2018/03/05 04:59:54 eadler Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1990, 1993\
#if 0
static char sccsid[] = "@(#)fish.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: fish.c,v 1.22 2011/09/01 07:18:50 plunky Exp $");
+__RCSID("$NetBSD: fish.c,v 1.23 2018/03/05 04:59:54 eadler Exp $");
#endif
#endif /* not lint */
@@ -171,9 +171,14 @@ usermove(void)
continue;
}
buf[strlen(buf) - 1] = '\0';
- if (!strcasecmp(buf, "p") && !promode) {
- promode = 1;
- (void)printf("Entering pro mode.\n");
+ if (!strcasecmp(buf, "p")) {
+ if (!promode) {
+ promode = 1;
+ printf("Entering pro mode.\n");
+ }
+ else {
+ printf("Already in pro mode.\n");
+ }
continue;
}
if (!strcasecmp(buf, "quit"))
@@ -186,10 +191,15 @@ usermove(void)
continue;
}
n = p - cards;
- if (userhand[n]) {
+ if (userhand[n] <= 3) {
userasked[n] = 1;
return(n);
}
+ if (userhand[n] == 4) {
+ printf("You already have all of those.\n");
+ continue;
+ }
+
if (nrandom(3) == 1)
(void)printf("You don't have any of those!\n");
else