fix nhl_loadlua() failures on Windows

The [dlb_]fopen() requires an RDBMODE argument on Windows.
ftell(), fseek(), and fread() interactions can be problematic otherwise.
This commit is contained in:
nhmall
2021-08-22 19:15:03 -04:00
parent 6dc99f69b7
commit 07fadd5e69
2 changed files with 4 additions and 1 deletions

View File

@@ -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 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 Windows: new tile additions in win/share did not trigger the creation of a new
NetHackW.res file 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 X11: was still initializing map to 'stone' instead of 'unexplored' after they
became separate glyphs became separate glyphs
X11: for text map without color, add support for black&white ice; draw it in X11: for text map without color, add support for black&white ice; draw it in

View File

@@ -1244,7 +1244,7 @@ nhl_loadlua(lua_State *L, const char *fname)
if we did, we could choose between "nhdat(<fname>)" and "<fname>" if we did, we could choose between "nhdat(<fname>)" and "<fname>"
but since we don't, compromise */ but since we don't, compromise */
Sprintf(altfname, "(%s)", fname); Sprintf(altfname, "(%s)", fname);
fh = dlb_fopen(fname, "r"); fh = dlb_fopen(fname, RDBMODE);
if (!fh) { if (!fh) {
impossible("nhl_loadlua: Error loading %s", altfname); impossible("nhl_loadlua: Error loading %s", altfname);
ret = FALSE; ret = FALSE;