NetBSD Problem Report #52973

From www@NetBSD.org  Fri Feb  2 10:01:30 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 8AA637A1FB
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  2 Feb 2018 10:01:30 +0000 (UTC)
Message-Id: <20180202100129.4AF297A224@mollari.NetBSD.org>
Date: Fri,  2 Feb 2018 10:01:29 +0000 (UTC)
From: lists@eitanadler.com
Reply-To: lists@eitanadler.com
To: gnats-bugs@NetBSD.org
Subject: [fish] don't allow users to request cards they have made books for
X-Send-Pr-Version: www-1.0

>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:    eadler
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 02 10:05:00 +0000 2018
>Closed-Date:    Mon Mar 05 05:00:33 +0000 2018
>Last-Modified:  Mon Mar 05 05:00:33 +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

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->eadler
Responsible-Changed-By: eadler@NetBSD.org
Responsible-Changed-When: Sun, 04 Mar 2018 21:42:15 +0000
Responsible-Changed-Why:
take


From: "Eitan Adler" <eadler@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/52973 CVS commit: src/games/fish
Date: Mon, 5 Mar 2018 04:59:54 +0000

 Module Name:	src
 Committed By:	eadler
 Date:		Mon Mar  5 04:59:54 UTC 2018

 Modified Files:
 	src/games/fish: fish.c

 Log Message:
 [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@


 To generate a diff of this commit:
 cvs rdiff -u -r1.22 -r1.23 src/games/fish/fish.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: eadler@NetBSD.org
State-Changed-When: Mon, 05 Mar 2018 05:00:33 +0000
State-Changed-Why:
Committed, thanks!

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.