dungeon open failure

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.
This commit is contained in:
nethack.allison
2006-05-07 14:32:04 +00:00
parent a71d270a21
commit 1a01343c63
2 changed files with 14 additions and 2 deletions
+1
View 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 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: support perm_invent
win32gui: menu option to add/remove windows captions win32gui: menu option to add/remove windows captions
win32gui: support for saving/restoring message history win32gui: support for saving/restoring message history
+13 -2
View File
@@ -6,6 +6,7 @@
#include "hack.h" #include "hack.h"
#include "dlb.h" #include "dlb.h"
#include "patchlevel.h"
#ifndef NO_SIGNAL #ifndef NO_SIGNAL
#include <signal.h> #include <signal.h>
@@ -271,6 +272,18 @@ char *argv[];
if (comp_times((long)time(&clock_time))) if (comp_times((long)time(&clock_time)))
error("Your clock is incorrectly set!"); error("Your clock is incorrectly set!");
#endif #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.uhp = 1; /* prevent RIP on early quits */
u.ux = 0; /* prevent flush_screen() */ u.ux = 0; /* prevent flush_screen() */
@@ -397,8 +410,6 @@ char *argv[];
*/ */
vision_init(); vision_init();
dlb_init();
display_gamewindows(); display_gamewindows();
#ifdef WIN32 #ifdef WIN32
getreturn_enabled = TRUE; getreturn_enabled = TRUE;