]> granicus.if.org Git - nethack/commitdiff
dungeon open failure
authornethack.allison <nethack.allison>
Sun, 7 May 2006 14:32:04 +0000 (14:32 +0000)
committernethack.allison <nethack.allison>
Sun, 7 May 2006 14:32:04 +0000 (14:32 +0000)
We've been getting numerous complaints from people
about "dungeon failure", often related to attempts
to start NetHack from within various zip utilities
that present a folder-like view.

The dungeon failure was actually misleading. The
real problem was a dlb file open failure, but the
return value of dlb_init() was not being checked
in pcmain.

This moves the dlb_init earlier in the startup,
checks for failure, and provides some feedback
around the common zip utility problem for win32.

doc/fixes35.0
sys/share/pcmain.c

index fe2f69f0f75d99612c9205a2cd739cb350a55529..57b360f185a98e1a18623fe38e8f13aad5a7bb56 100644 (file)
@@ -203,6 +203,7 @@ some monsters can eat tins in addition to corpses to cure some ailments
 
 Platform- and/or Interface-Specific New Features
 ------------------------------------------------
+pcmain: check for dlb_init failure rather than relying on dungeon open failure
 win32gui: support perm_invent
 win32gui: menu option to add/remove windows captions
 win32gui: support for saving/restoring message history
index a93e5c5b08d35399fdc71930486796df2eebbf23..3d917509ee15d8bcb081969a17a6b862dd757551 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "hack.h"
 #include "dlb.h"
+#include "patchlevel.h"
 
 #ifndef NO_SIGNAL
 #include <signal.h>
@@ -271,6 +272,18 @@ char *argv[];
        if (comp_times((long)time(&clock_time)))
                error("Your clock is incorrectly set!");
 #endif
+       if (!dlb_init()) {
+           pline("%s\n%s\n%s\n\nNetHack was unable to open the required file \"%s\".%s",
+               COPYRIGHT_BANNER_A, COPYRIGHT_BANNER_B,
+               COPYRIGHT_BANNER_C, DLBFILE,
+#ifdef WIN32
+                       "\nAre you perhaps trying to run NetHack within a zip utility?");
+#else
+                       "");
+#endif
+               error("dlb_init failure.");
+       }
+
        u.uhp = 1;      /* prevent RIP on early quits */
        u.ux = 0;       /* prevent flush_screen() */
 
@@ -397,8 +410,6 @@ char *argv[];
         */
        vision_init();
 
-       dlb_init();
-
        display_gamewindows();
 #ifdef WIN32
        getreturn_enabled = TRUE;