simplify infrom() prompt mechanism
authorKen Arnold <arnold@ucbvax.Berkeley.EDU>
Sat, 28 Aug 1982 14:04:57 +0000 (06:04 -0800)
committerKen Arnold <arnold@ucbvax.Berkeley.EDU>
Sat, 28 Aug 1982 14:04:57 +0000 (06:04 -0800)
SCCS-vsn: games/cribbage/io.c 1.5
SCCS-vsn: games/cribbage/crib.c 1.6

usr/src/games/cribbage/crib.c
usr/src/games/cribbage/io.c

index 7d992d8..5f9d79a 100644 (file)
@@ -280,14 +280,12 @@ BOOLEAN           mycrib;
 
        prcrib(mycrib, TRUE);
        prompt = (quiet ? "Discard --> " : "Discard a card --> ");
 
        prcrib(mycrib, TRUE);
        prompt = (quiet ? "Discard --> " : "Discard a card --> ");
-       msg(prompt);
        cdiscard(mycrib);                       /* puts best discard at end */
        crd = phand[infrom(phand, FULLHAND, prompt)];
        remove(crd, phand, FULLHAND);
        prhand(phand, FULLHAND, Playwin);
        crib[0] = crd;
 /* next four lines same as last four except for cdiscard() */
        cdiscard(mycrib);                       /* puts best discard at end */
        crd = phand[infrom(phand, FULLHAND, prompt)];
        remove(crd, phand, FULLHAND);
        prhand(phand, FULLHAND, Playwin);
        crib[0] = crd;
 /* next four lines same as last four except for cdiscard() */
-       msg(prompt);
        crd = phand[infrom(phand, FULLHAND - 1, prompt)];
        remove(crd, phand, FULLHAND - 1);
        prhand(phand, FULLHAND, Playwin);
        crd = phand[infrom(phand, FULLHAND - 1, prompt)];
        remove(crd, phand, FULLHAND - 1);
        prhand(phand, FULLHAND, Playwin);
@@ -462,7 +460,6 @@ BOOLEAN             mycrib;
                    }
                    else
                        for (;;) {
                    }
                    else
                        for (;;) {
-                           msg("Your play: ");
                            prhand(ph, pnum, Playwin);
                            crd = ph[infrom(ph, pnum, "Your play: ")];
                            if (sum + VAL(crd.rank) <= 31)
                            prhand(ph, pnum, Playwin);
                            crd = ph[infrom(ph, pnum, "Your play: ")];
                            if (sum + VAL(crd.rank) <= 31)
index 38cae27..a49ead5 100644 (file)
@@ -144,6 +144,7 @@ char                *prompt;
            exit(74);
        }
        for (;;) {
            exit(74);
        }
        for (;;) {
+           msg(prompt);
            if (incard(&crd)) {                 /* if card is full card */
                if (!isone(crd, hand, n))
                    msg("That's not in your hand");
            if (incard(&crd)) {                 /* if card is full card */
                if (!isone(crd, hand, n))
                    msg("That's not in your hand");
@@ -178,7 +179,6 @@ char                *prompt;
                }
                else
                    msg("Sorry, I missed that");
                }
                else
                    msg("Sorry, I missed that");
-           msg(prompt);
        }
        /* NOTREACHED */
 }
        }
        /* NOTREACHED */
 }