]> granicus.if.org Git - nethack/commitdiff
allow #exploremode from wizard mode
authorPatR <rankin@nethack.org>
Wed, 16 Dec 2020 11:07:55 +0000 (03:07 -0800)
committerPatR <rankin@nethack.org>
Wed, 16 Dec 2020 11:07:55 +0000 (03:07 -0800)
Allow changing form debug mode to explore mode without resorting
to a debugger.  The same caveat, "you won't be able to change back,"
applies as when in normal play.

Character's name will remain "wizard" rather than reverting to
whatever it would have been if not starting in wizard mode.

src/cmd.c

index f8a6fc428c895917cdb8d763034e0fd4839ea14f..275c71e468f37466c2a3d88d3736f02327ee239e 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1,4 +1,4 @@
-/* NetHack 3.7 cmd.c   $NHDT-Date: 1608078812 2020/12/16 00:33:32 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.434 $ */
+/* NetHack 3.7 cmd.c   $NHDT-Date: 1608116853 2020/12/16 11:07:33 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.435 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -750,30 +750,37 @@ domonability(VOID_ARGS)
 int
 enter_explore_mode(VOID_ARGS)
 {
-    if (wizard) {
-        You("are in debug mode.");
-    } else if (discover) {
+    if (discover) {
         You("are already in explore mode.");
     } else {
+        const char *oldmode = !wizard ? "normal game" : "debug mode";
+
 #ifdef SYSCF
 #if defined(UNIX)
         if (!sysopt.explorers || !sysopt.explorers[0]
             || !check_user_string(sysopt.explorers)) {
-            You("cannot access explore mode.");
-            return 0;
+            if (!wizard) {
+                You("cannot access explore mode.");
+                return 0;
+            } else {
+                pline(
+                 "Note: normally you wouldn't be allowed into explore mode.");
+                /* keep going */
+            }
         }
 #endif
 #endif
-        pline(
-        "Beware!  From explore mode there will be no return to normal game.");
+        pline("Beware!  From explore mode there will be no return to %s,",
+              oldmode);
         if (paranoid_query(ParanoidQuit,
                            "Do you want to enter explore mode?")) {
+            discover = TRUE;
+            wizard = FALSE;
             clear_nhwindow(WIN_MESSAGE);
             You("are now in non-scoring explore mode.");
-            discover = TRUE;
         } else {
             clear_nhwindow(WIN_MESSAGE);
-            pline("Resuming normal game.");
+            pline("Continuing with %s.", oldmode);
         }
     }
     return 0;