]> granicus.if.org Git - nethack/commitdiff
auto credit
authornethack.allison <nethack.allison>
Tue, 8 Jan 2002 04:42:29 +0000 (04:42 +0000)
committernethack.allison <nethack.allison>
Tue, 8 Jan 2002 04:42:29 +0000 (04:42 +0000)
Yes, you were right.  There is a reason to have a separate auto_credit flag.

src/shk.c

index d442bf0b3a86e08c126cd4d4ad5971215fdb8da7..ff64a11fb3b704f999a75aa477a589d3b6043d8a 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -2459,6 +2459,9 @@ register boolean peaceful, silent;
 /* auto-response flag for/from "sell foo?" 'a' => 'y', 'q' => 'n' */
 static char sell_response = 'a';
 static int sell_how = SELL_NORMAL;
+/* can't just use sell_response='y' for auto_credit because the 'a' response
+   shouldn't carry over from ordinary selling to credit selling */
+static boolean auto_credit = FALSE;
 
 void
 sellobj_state(deliberate)
@@ -2472,6 +2475,7 @@ int deliberate;
         */
        sell_response = (deliberate != SELL_NORMAL) ? '\0' : 'a';
        sell_how = deliberate;
+       auto_credit = FALSE;
 }
 
 void
@@ -2622,7 +2626,7 @@ move_on:
                char c, qbuf[BUFSZ];
                long tmpcr = ((offer * 9L) / 10L) + (offer <= 1L);
 
-               if (sell_how == SELL_NORMAL || sell_response == 'y') {
+               if (sell_how == SELL_NORMAL || auto_credit) {
                    c = sell_response = 'y';
                } else if (sell_response != 'n') {
                    pline("%s cannot pay you at present.", Monnam(shkp));
@@ -2635,7 +2639,7 @@ move_on:
                    c = ynaq(qbuf);
                    if (c == 'a') {
                        c = 'y';
-                       sell_response = 'y';
+                       auto_credit = TRUE;
                    }
                } else          /* previously specified "quit" */
                    c = 'n';