]> granicus.if.org Git - nethack/commitdiff
fix #H8167 - shopkeeper message after ending game
authorPatR <rankin@nethack.org>
Mon, 11 Feb 2019 01:45:26 +0000 (17:45 -0800)
committerPatR <rankin@nethack.org>
Mon, 11 Feb 2019 01:45:26 +0000 (17:45 -0800)
Closing nethack's window sets 'program_state.stopprint' to inhibit
disclosure interaction, but shopkeeper claiming hero's stuff or vault
guard claiming hero's gold didn't honor that and just issued normal
pline messages.  For win32, they got delivered in a popup even though
nethack's window had gone away.

Make those two end-of-game situations honor 'program_state.stopprint'.
[Fix not tested on win32...]

doc/fixes36.2
src/shk.c
src/vault.c

index 20533a88648e366944bad921d1aea66d621c44a7..2ef6a15045c9f0d5bd6895989fa67763653e68e9 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.254 $ $NHDT-Date: 1549835645 2019/02/10 21:54:05 $
+$NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.255 $ $NHDT-Date: 1549849509 2019/02/11 01:45:09 $
 
 This fixes36.2 file is here to capture information about updates in the 3.6.x
 lineage following the release of 3.6.1 in April 2018. Please note, however,
@@ -464,6 +464,8 @@ windows-gui: recognize new BL_RESET in status_update; no change in behavior yet
 windows-gui: align hpbar behavior at zero hit points with tty behavior
 windows-gui: add support for status_hilites for the player condition field
        such as stone, slime, strngl, blind, deaf, stun, conf, etc.
+windows-gui: a shop or vault message could appear in a popup after the
+       close-window button was used when game was ending
 windows-tty: Specify both width and height when creating font for width testing
 windows-tty: To counter lag problems that were occuring with the Win32 console
        port, implement a console back buffer to reduce the number of calls
index 09892e70911e1b679691077af977314623662838..701f41e1247103e5c75ce868e94bf1140b5f046f 100644 (file)
--- a/src/shk.c
+++ b/src/shk.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 shk.c   $NHDT-Date: 1548978606 2019/01/31 23:50:06 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.154 $ */
+/* NetHack 3.6 shk.c   $NHDT-Date: 1549849510 2019/02/11 01:45:10 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.155 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1781,16 +1781,23 @@ int croaked;
     long loss = 0L;
     long umoney;
     struct eshk *eshkp = ESHK(shkp);
-    boolean take = FALSE, taken = FALSE;
+    boolean take = FALSE, taken = FALSE, verbose;
     unsigned save_minvis = shkp->minvis;
     int roomno = *u.ushops;
     char takes[BUFSZ];
 
+    verbose = !program_state.stopprint;
+#ifdef HANGUPHANDLING
+    verbose &= !program_state.done_hup;
+#endif
+    /* not strictly consistent; affects messages and prevents next player
+       (if bones are saved) from blundering into or being ambused by an
+       invisible shopkeeper */
     shkp->minvis = 0;
     /* The simplifying principle is that first-come
        already took everything you had. */
     if (numsk > 1) {
-        if (cansee(shkp->mx, shkp->my) && croaked) {
+        if (verbose && cansee(shkp->mx, shkp->my) && croaked) {
             takes[0] = '\0';
             if (has_head(shkp->data) && !rn2(2))
                 Sprintf(takes, ", shakes %s %s,", noit_mhis(shkp),
@@ -1810,7 +1817,7 @@ int croaked;
         && !eshkp->robbed && !eshkp->debit && NOTANGRY(shkp)
         && !eshkp->following && u.ugrave_arise < LOW_PM) {
         taken = (invent != 0);
-        if (taken)
+        if (taken && verbose)
             pline("%s gratefully inherits all your possessions.",
                   Shknam(shkp));
         set_repo_loc(shkp);
@@ -1844,17 +1851,19 @@ int croaked;
                 money2mon(shkp, umoney);
                 context.botl = 1;
             }
-            pline("%s %s all your possessions.", Shknam(shkp), takes);
+            if (verbose)
+                pline("%s %s all your possessions.", Shknam(shkp), takes);
             taken = TRUE;
             /* where to put player's invent (after disclosure) */
             set_repo_loc(shkp);
         } else {
             money2mon(shkp, loss);
             context.botl = 1;
-            pline("%s %s the %ld %s %sowed %s.", Shknam(shkp),
-                  takes, loss, currency(loss),
-                  strncmp(eshkp->customer, plname, PL_NSIZ) ? "" : "you ",
-                  noit_mhim(shkp));
+            if (verbose)
+                pline("%s %s the %ld %s %sowed %s.", Shknam(shkp),
+                      takes, loss, currency(loss),
+                      strncmp(eshkp->customer, plname, PL_NSIZ) ? "" : "you ",
+                      noit_mhim(shkp));
             /* shopkeeper has now been paid in full */
             pacify_shk(shkp);
             eshkp->following = 0;
@@ -1866,7 +1875,7 @@ int croaked;
         if (!inhishop(shkp))
             home_shk(shkp, FALSE);
     }
-clear:
+ clear:
     shkp->minvis = save_minvis;
     setpaid(shkp);
     return taken;
@@ -1900,7 +1909,8 @@ struct monst *shkp;
     repo.shopkeeper = shkp;
 }
 
-/* called at game exit, after inventory disclosure but before making bones */
+/* called at game exit, after inventory disclosure but before making bones;
+   shouldn't issue any messages */
 void
 finish_paybill()
 {
index 669cc52e37d1c3589d69e36edcfceb6fb02f9f0f..32c5cb49024c31ce9bed87c9723b9502f204946d 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 vault.c $NHDT-Date: 1549157816 2019/02/03 01:36:56 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.60 $ */
+/* NetHack 3.6 vault.c $NHDT-Date: 1549849513 2019/02/11 01:45:13 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.61 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2011. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -1068,13 +1068,19 @@ paygd()
     struct obj *coins, *nextcoins;
     int gx, gy;
     char buf[BUFSZ];
+    boolean verbose;
 
     if (!umoney || !grd)
         return;
 
+    verbose = !program_state.stopprint;
+#ifdef HANGUPHANDLING
+    verbose &= !program_state.done_hup;
+#endif
     if (u.uinvault) {
-        Your("%ld %s goes into the Magic Memory Vault.", umoney,
-             currency(umoney));
+        if (verbose)
+            Your("%ld %s goes into the Magic Memory Vault.",
+                 umoney, currency(umoney));
         gx = u.ux;
         gy = u.uy;
     } else {
@@ -1083,7 +1089,8 @@ paygd()
             return;
         }
         mnexto(grd);
-        pline("%s remits your gold to the vault.", Monnam(grd));
+        if (verbose)
+            pline("%s remits your gold to the vault.", Monnam(grd));
         gx = rooms[EGD(grd)->vroom].lx + rn2(2);
         gy = rooms[EGD(grd)->vroom].ly + rn2(2);
         Sprintf(buf, "To Croesus: here's the gold recovered from %s the %s.",