From 1a01343c6386ad5e75a0e35ae8393d8338fe22c6 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Sun, 7 May 2006 14:32:04 +0000 Subject: [PATCH] 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. --- doc/fixes35.0 | 1 + sys/share/pcmain.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index fe2f69f0f..57b360f18 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index a93e5c5b0..3d917509e 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -6,6 +6,7 @@ #include "hack.h" #include "dlb.h" +#include "patchlevel.h" #ifndef NO_SIGNAL #include @@ -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; -- 2.40.0