NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/52973: [fish] don't allow users to request cards they have made books for



>Number:         52973
>Category:       bin
>Synopsis:       [fish] don't allow users to request cards they have made books for
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 02 10:05:00 +0000 2018
>Originator:     Eitan Adler
>Release:        HEAD
>Organization:
>Environment:
>Description:
It is not technically legal to request a card you don't have in your hand, even if you have the book for it. This really only matters if you're playing with more than one deck, which fish(6) does not support, but since this is a critical bug, fix it.

While here, handle pressing 'p' while already in promode as not an error
>How-To-Repeat:
Have in your hand
anything + "book of X"
request X
>Fix:
Index: fish.c
===================================================================
RCS file: /cvsroot/src/games/fish/fish.c,v
retrieving revision 1.22
diff -u -r1.22 fish.c
--- fish.c	1 Sep 2011 07:18:50 -0000	1.22
+++ fish.c	2 Feb 2018 10:00:52 -0000
@@ -171,9 +171,11 @@
 			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;
+				(void)printf("Entering pro mode.\n");
+			}
 			continue;
 		}
 		if (!strcasecmp(buf, "quit"))
@@ -186,10 +188,15 @@
 			continue;
 		}
 		n = p - cards;
-		if (userhand[n]) {
+		if (userhand[n] <= 3) {
 			userasked[n] = 1;
 			return(n);
 		}
+		if (userhand[n] == 4) {
+			(void)printf("You already have all of those.\n");
+			continue;
+		}
+
 		if (nrandom(3) == 1)
 			(void)printf("You don't have any of those!\n");
 		else



Home | Main Index | Thread Index | Old Index