fix the msdos build for NetHack-3.7

This commit is contained in:
nhmall
2019-07-02 22:05:36 -04:00
parent 4b2b2d5ba1
commit efbe179f64
5 changed files with 49 additions and 30 deletions

View File

@@ -7,13 +7,13 @@
#define DECL_H
#define E extern
#if !defined(MFLOPPY) && !defined(VMS) && !defined(WIN32)
#if !defined(MICRO) && !defined(VMS) && !defined(WIN32)
#define LOCKNAMESIZE (PL_NSIZ + 14) /* long enough for uid+name+.99 */
#define LOCKNAMEINIT "1lock"
#define BONESINIT "bonesnn.xxx"
#define BONESSIZE sizeof(BONESINIT)
#else
#if defined(MFLOPPY)
#if defined(MICRO)
#define LOCKNAMESIZE FILENAME
#define LOCKNAMEINIT ""
#define BONESINIT ""
@@ -52,7 +52,7 @@
#define SAVEX ""
#if !defined(SAVE_EXTENSION)
#ifdef MICRO
#define SAVE_EXTENSION ".sav"
#define SAVE_EXTENSION ".svh"
#endif
#ifdef WIN32
#define SAVE_EXTENSION ".NetHack-saved-game"

View File

@@ -1045,7 +1045,14 @@ boolean regularize_it;
regoffset = 5;
indicator_spot = 2;
#endif
#if defined(MICRO) && !defined(VMS) && !defined(WIN32)
#if defined(MSDOS)
if (strlen(g.SAVEP) < (SAVESIZE - 1))
Strcpy(g.SAVEF, g.SAVEP);
if (strlen(g.SAVEF) < (SAVESIZE - 1))
(void) strncat(g.SAVEF, g.plname,
(SAVESIZE - strlen(g.SAVEF)));
#endif
#if defined(MICRO) && !defined(VMS) && !defined(WIN32) && !defined(MSDOS)
if (strlen(g.SAVEP) < (SAVESIZE - 1))
Strcpy(g.SAVEF, g.SAVEP);
else
@@ -1076,9 +1083,20 @@ boolean regularize_it;
}
#ifdef SAVE_EXTENSION
if (strlen(SAVE_EXTENSION) > 0 && !overflow) {
if (strlen(g.SAVEF) + strlen(SAVE_EXTENSION) < (SAVESIZE - 1))
if (strlen(g.SAVEF) + strlen(SAVE_EXTENSION) < (SAVESIZE - 1)) {
Strcat(g.SAVEF, SAVE_EXTENSION);
else
#ifdef MSDOS
#ifdef SYSCF
if (idx >= historical && idx <= ascii) {
/* we did leave room for the extra char in SAVE_EXTENSION */
g.SAVEF[strlen(g.SAVEF)-1] =
(idx == lendian) ? 'l' :
(idx == ascii) ? 'a' : '\0';
}
sfindicator = sfoprocs[idx].ext;
#endif
#endif
} else
overflow = 3;
}
#endif

View File

@@ -62,7 +62,7 @@ extern int attrib_text_normal; /* text mode normal attribute */
extern int attrib_gr_normal; /* graphics mode normal attribute */
extern int attrib_gr_intense; /* graphics mode intense attribute */
extern boolean inmap; /* in the map window */
extern boolean restoring;
/* extern boolean g.restoring; */
/*
* Global Variables
@@ -609,7 +609,7 @@ int x, y;
clipx = clipxmax - (viewport_size - 1);
}
if (clipx != oldx) {
if (on_level(&u.uz0, &u.uz) && !restoring)
if (on_level(&u.uz0, &u.uz) && !g.restoring)
/* (void) doredraw(); */
vesa_redrawmap();
}

View File

@@ -435,7 +435,7 @@ static void
vga_cliparound(x, y)
int x, y;
{
extern boolean restoring;
/* extern boolean g.restoring; */
int oldx = clipx;
if (!iflags.tile_view || iflags.over_view || iflags.traditional_view)
@@ -449,7 +449,7 @@ int x, y;
clipx = clipxmax - (viewport_size - 1);
}
if (clipx != oldx) {
if (on_level(&u.uz0, &u.uz) && !restoring)
if (on_level(&u.uz0, &u.uz) && !g.restoring)
/* (void) doredraw(); */
vga_redrawmap(1);
}

View File

@@ -7,6 +7,7 @@
#include "hack.h"
#include "dlb.h"
#include "sfproto.h"
#ifndef NO_SIGNAL
#include <signal.h>
@@ -185,17 +186,17 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
int fd;
boolean have_syscf = FALSE;
(void) strncpy(hackdir, dir, PATHLEN - 1);
hackdir[PATHLEN - 1] = '\0';
(void) strncpy(g.hackdir, dir, PATHLEN - 1);
g.hackdir[PATHLEN - 1] = '\0';
#ifdef NOCWD_ASSUMPTIONS
{
int prefcnt;
fqn_prefix[0] = (char *) alloc(strlen(hackdir) + 2);
Strcpy(fqn_prefix[0], hackdir);
append_slash(fqn_prefix[0]);
g.fqn_prefix[0] = (char *) alloc(strlen(g.hackdir) + 2);
Strcpy(g.fqn_prefix[0], g.hackdir);
append_slash(g.fqn_prefix[0]);
for (prefcnt = 1; prefcnt < PREFIX_COUNT; prefcnt++)
fqn_prefix[prefcnt] = fqn_prefix[0];
g.fqn_prefix[prefcnt] = g.fqn_prefix[0];
#if defined(MSDOS)
/* sysconf should be searched for in this location */
@@ -204,11 +205,11 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
if ((sptr = index(envp, ';')) != 0)
*sptr = '\0';
if (strlen(envp) > 0) {
fqn_prefix[SYSCONFPREFIX] =
g.fqn_prefix[SYSCONFPREFIX] =
(char *) alloc(strlen(envp) + 10);
Strcpy(fqn_prefix[SYSCONFPREFIX], envp);
append_slash(fqn_prefix[SYSCONFPREFIX]);
Strcat(fqn_prefix[SYSCONFPREFIX], "NetHack\\");
Strcpy(g.fqn_prefix[SYSCONFPREFIX], envp);
append_slash(g.fqn_prefix[SYSCONFPREFIX]);
Strcat(g.fqn_prefix[SYSCONFPREFIX], "NetHack\\");
}
}
@@ -229,7 +230,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
/* No SYSCF_FILE where there should be one, and
without an installer, a user may not be able
to place one there. So, let's try somewhere else... */
fqn_prefix[SYSCONFPREFIX] = fqn_prefix[0];
g.fqn_prefix[SYSCONFPREFIX] = g.fqn_prefix[0];
/* Is there a SYSCF_FILE there? */
fd = open(fqname(SYSCF_FILE, SYSCONFPREFIX, 0), O_RDONLY);
@@ -247,10 +248,10 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
if ((sptr = index(envp, ';')) != 0)
*sptr = '\0';
if (strlen(envp) > 0) {
fqn_prefix[CONFIGPREFIX] =
g.fqn_prefix[CONFIGPREFIX] =
(char *) alloc(strlen(envp) + 2);
Strcpy(fqn_prefix[CONFIGPREFIX], envp);
append_slash(fqn_prefix[CONFIGPREFIX]);
Strcpy(g.fqn_prefix[CONFIGPREFIX], envp);
append_slash(g.fqn_prefix[CONFIGPREFIX]);
}
}
#endif
@@ -286,11 +287,11 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
if (iflags.BIOS && iflags.use_color)
set_colors();
#endif
if (!hackdir[0])
if (!g.hackdir[0])
#if !defined(LATTICE) && !defined(AMIGA)
Strcpy(hackdir, orgdir);
Strcpy(g.hackdir, orgdir);
#else
Strcpy(hackdir, HACKDIR);
Strcpy(g.hackdir, HACKDIR);
#endif
if (argc > 1) {
if (argcheck(argc, argv, ARG_VERSION) == 2)
@@ -317,7 +318,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
}
if (!*dir)
error("Flag -d must be followed by a directory name.");
Strcpy(hackdir, dir);
Strcpy(g.hackdir, dir);
}
if (argc > 1) {
/*
@@ -326,7 +327,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
*/
if (!strncmp(argv[1], "-s", 2)) {
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(hackdir, 0);
chdirx(g.hackdir, 0);
#endif
#ifdef SYSCF
initoptions();
@@ -366,7 +367,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
* code parallel to other ports.
*/
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(hackdir, 1);
chdirx(g.hackdir, 1);
#endif
#if defined(MSDOS)