]> granicus.if.org Git - nethack/commitdiff
minor #wizmakemap fix - revoked achievements
authorPatR <rankin@nethack.org>
Sun, 8 Mar 2020 21:51:22 +0000 (14:51 -0700)
committerPatR <rankin@nethack.org>
Sun, 8 Mar 2020 21:51:22 +0000 (14:51 -0700)
When replacing Mines' End or top of Sokoban, the achievement for
finding the special prize there is reset.  But the code to do so was
accidentally inside the monster processing loop and got repeated for
each monster on the old instance of the level (essentially a no-op
after the first one though).  That code had been updated more than
once without noticing.  Move it out of the loop.

src/cmd.c

index bf8076d7d073770c56c9e809278227effcfbfea2..34e3b72db27199b00a3d35d8f8610b813e418ede 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 cmd.c   $NHDT-Date: 1582594149 2020/02/25 01:29:09 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.406 $ */
+/* NetHack 3.6 cmd.c   $NHDT-Date: 1583704247 2020/03/08 21:50:47 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.408 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -793,19 +793,21 @@ boolean pre, wiztower;
                 continue;
             if (mtmp->isshk)
                 setpaid(mtmp);
-            /* achievement tracking */
-            {
-                static const char Unachieve[] = "%s achievement revoked.";
-
-                if (Is_mineend_level(&u.uz)) {
-                    if (remove_achievement(ACH_MINE_PRIZE))
-                        pline(Unachieve, "Mine's-end");
-                    g.context.achieveo.mines_prize_oid = 0;
-                } else if (Is_sokoend_level(&u.uz)) {
-                    if (remove_achievement(ACH_SOKO_PRIZE))
-                        pline(Unachieve, "Sokoban-end");
-                    g.context.achieveo.soko_prize_oid = 0;
-                }
+        }
+        {
+            static const char Unachieve[] = "%s achievement revoked.";
+
+            /* achievement tracking; if replacing a level that has a
+               special prize, lose credit for previously finding it and
+               reset for the new instance of that prize */
+            if (Is_mineend_level(&u.uz)) {
+                if (remove_achievement(ACH_MINE_PRIZE))
+                    pline(Unachieve, "Mine's-end");
+                g.context.achieveo.mines_prize_oid = 0;
+            } else if (Is_sokoend_level(&u.uz)) {
+                if (remove_achievement(ACH_SOKO_PRIZE))
+                    pline(Unachieve, "Soko-prize");
+                g.context.achieveo.soko_prize_oid = 0;
             }
         }
         if (Punished) {