From: nhmall Date: Sun, 22 Aug 2021 23:15:03 +0000 (-0400) Subject: fix nhl_loadlua() failures on Windows X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=07fadd5e69eb09cb6753f8a09d09fe53aa516e21;p=nethack fix nhl_loadlua() failures on Windows The [dlb_]fopen() requires an RDBMODE argument on Windows. ftell(), fseek(), and fread() interactions can be problematic otherwise. --- diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 404bd63a6..eab03e04e 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -804,6 +804,9 @@ Unix: after lua changes to Makefiles, 'make spotless' for dat subdirectory left some generated data files which should have been deleted Windows: new tile additions in win/share did not trigger the creation of a new NetHackW.res file +Windows: nhl_loadlua() was missing the RDBMODE argument on the [dlb_]fopen() + that is necessary to ensure binary mode for navigating around a file + with fseek(), ftell() and fread() reliably X11: was still initializing map to 'stone' instead of 'unexplored' after they became separate glyphs X11: for text map without color, add support for black&white ice; draw it in diff --git a/src/nhlua.c b/src/nhlua.c index 92b0808ea..92a942b92 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -1244,7 +1244,7 @@ nhl_loadlua(lua_State *L, const char *fname) if we did, we could choose between "nhdat()" and "" but since we don't, compromise */ Sprintf(altfname, "(%s)", fname); - fh = dlb_fopen(fname, "r"); + fh = dlb_fopen(fname, RDBMODE); if (!fh) { impossible("nhl_loadlua: Error loading %s", altfname); ret = FALSE;