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
+3 -3
View File
@@ -7,13 +7,13 @@
#define DECL_H #define DECL_H
#define E extern #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 LOCKNAMESIZE (PL_NSIZ + 14) /* long enough for uid+name+.99 */
#define LOCKNAMEINIT "1lock" #define LOCKNAMEINIT "1lock"
#define BONESINIT "bonesnn.xxx" #define BONESINIT "bonesnn.xxx"
#define BONESSIZE sizeof(BONESINIT) #define BONESSIZE sizeof(BONESINIT)
#else #else
#if defined(MFLOPPY) #if defined(MICRO)
#define LOCKNAMESIZE FILENAME #define LOCKNAMESIZE FILENAME
#define LOCKNAMEINIT "" #define LOCKNAMEINIT ""
#define BONESINIT "" #define BONESINIT ""
@@ -52,7 +52,7 @@
#define SAVEX "" #define SAVEX ""
#if !defined(SAVE_EXTENSION) #if !defined(SAVE_EXTENSION)
#ifdef MICRO #ifdef MICRO
#define SAVE_EXTENSION ".sav" #define SAVE_EXTENSION ".svh"
#endif #endif
#ifdef WIN32 #ifdef WIN32
#define SAVE_EXTENSION ".NetHack-saved-game" #define SAVE_EXTENSION ".NetHack-saved-game"
+21 -3
View File
@@ -1045,7 +1045,14 @@ boolean regularize_it;
regoffset = 5; regoffset = 5;
indicator_spot = 2; indicator_spot = 2;
#endif #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)) if (strlen(g.SAVEP) < (SAVESIZE - 1))
Strcpy(g.SAVEF, g.SAVEP); Strcpy(g.SAVEF, g.SAVEP);
else else
@@ -1076,9 +1083,20 @@ boolean regularize_it;
} }
#ifdef SAVE_EXTENSION #ifdef SAVE_EXTENSION
if (strlen(SAVE_EXTENSION) > 0 && !overflow) { 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); 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; overflow = 3;
} }
#endif #endif
+2 -2
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_normal; /* graphics mode normal attribute */
extern int attrib_gr_intense; /* graphics mode intense attribute */ extern int attrib_gr_intense; /* graphics mode intense attribute */
extern boolean inmap; /* in the map window */ extern boolean inmap; /* in the map window */
extern boolean restoring; /* extern boolean g.restoring; */
/* /*
* Global Variables * Global Variables
@@ -609,7 +609,7 @@ int x, y;
clipx = clipxmax - (viewport_size - 1); clipx = clipxmax - (viewport_size - 1);
} }
if (clipx != oldx) { if (clipx != oldx) {
if (on_level(&u.uz0, &u.uz) && !restoring) if (on_level(&u.uz0, &u.uz) && !g.restoring)
/* (void) doredraw(); */ /* (void) doredraw(); */
vesa_redrawmap(); vesa_redrawmap();
} }
+2 -2
View File
@@ -435,7 +435,7 @@ static void
vga_cliparound(x, y) vga_cliparound(x, y)
int x, y; int x, y;
{ {
extern boolean restoring; /* extern boolean g.restoring; */
int oldx = clipx; int oldx = clipx;
if (!iflags.tile_view || iflags.over_view || iflags.traditional_view) if (!iflags.tile_view || iflags.over_view || iflags.traditional_view)
@@ -449,7 +449,7 @@ int x, y;
clipx = clipxmax - (viewport_size - 1); clipx = clipxmax - (viewport_size - 1);
} }
if (clipx != oldx) { if (clipx != oldx) {
if (on_level(&u.uz0, &u.uz) && !restoring) if (on_level(&u.uz0, &u.uz) && !g.restoring)
/* (void) doredraw(); */ /* (void) doredraw(); */
vga_redrawmap(1); vga_redrawmap(1);
} }
+21 -20
View File
@@ -7,6 +7,7 @@
#include "hack.h" #include "hack.h"
#include "dlb.h" #include "dlb.h"
#include "sfproto.h"
#ifndef NO_SIGNAL #ifndef NO_SIGNAL
#include <signal.h> #include <signal.h>
@@ -185,17 +186,17 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
int fd; int fd;
boolean have_syscf = FALSE; boolean have_syscf = FALSE;
(void) strncpy(hackdir, dir, PATHLEN - 1); (void) strncpy(g.hackdir, dir, PATHLEN - 1);
hackdir[PATHLEN - 1] = '\0'; g.hackdir[PATHLEN - 1] = '\0';
#ifdef NOCWD_ASSUMPTIONS #ifdef NOCWD_ASSUMPTIONS
{ {
int prefcnt; int prefcnt;
fqn_prefix[0] = (char *) alloc(strlen(hackdir) + 2); g.fqn_prefix[0] = (char *) alloc(strlen(g.hackdir) + 2);
Strcpy(fqn_prefix[0], hackdir); Strcpy(g.fqn_prefix[0], g.hackdir);
append_slash(fqn_prefix[0]); append_slash(g.fqn_prefix[0]);
for (prefcnt = 1; prefcnt < PREFIX_COUNT; prefcnt++) for (prefcnt = 1; prefcnt < PREFIX_COUNT; prefcnt++)
fqn_prefix[prefcnt] = fqn_prefix[0]; g.fqn_prefix[prefcnt] = g.fqn_prefix[0];
#if defined(MSDOS) #if defined(MSDOS)
/* sysconf should be searched for in this location */ /* sysconf should be searched for in this location */
@@ -204,11 +205,11 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
if ((sptr = index(envp, ';')) != 0) if ((sptr = index(envp, ';')) != 0)
*sptr = '\0'; *sptr = '\0';
if (strlen(envp) > 0) { if (strlen(envp) > 0) {
fqn_prefix[SYSCONFPREFIX] = g.fqn_prefix[SYSCONFPREFIX] =
(char *) alloc(strlen(envp) + 10); (char *) alloc(strlen(envp) + 10);
Strcpy(fqn_prefix[SYSCONFPREFIX], envp); Strcpy(g.fqn_prefix[SYSCONFPREFIX], envp);
append_slash(fqn_prefix[SYSCONFPREFIX]); append_slash(g.fqn_prefix[SYSCONFPREFIX]);
Strcat(fqn_prefix[SYSCONFPREFIX], "NetHack\\"); 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 /* No SYSCF_FILE where there should be one, and
without an installer, a user may not be able without an installer, a user may not be able
to place one there. So, let's try somewhere else... */ 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? */ /* Is there a SYSCF_FILE there? */
fd = open(fqname(SYSCF_FILE, SYSCONFPREFIX, 0), O_RDONLY); fd = open(fqname(SYSCF_FILE, SYSCONFPREFIX, 0), O_RDONLY);
@@ -247,10 +248,10 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
if ((sptr = index(envp, ';')) != 0) if ((sptr = index(envp, ';')) != 0)
*sptr = '\0'; *sptr = '\0';
if (strlen(envp) > 0) { if (strlen(envp) > 0) {
fqn_prefix[CONFIGPREFIX] = g.fqn_prefix[CONFIGPREFIX] =
(char *) alloc(strlen(envp) + 2); (char *) alloc(strlen(envp) + 2);
Strcpy(fqn_prefix[CONFIGPREFIX], envp); Strcpy(g.fqn_prefix[CONFIGPREFIX], envp);
append_slash(fqn_prefix[CONFIGPREFIX]); append_slash(g.fqn_prefix[CONFIGPREFIX]);
} }
} }
#endif #endif
@@ -286,11 +287,11 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
if (iflags.BIOS && iflags.use_color) if (iflags.BIOS && iflags.use_color)
set_colors(); set_colors();
#endif #endif
if (!hackdir[0]) if (!g.hackdir[0])
#if !defined(LATTICE) && !defined(AMIGA) #if !defined(LATTICE) && !defined(AMIGA)
Strcpy(hackdir, orgdir); Strcpy(g.hackdir, orgdir);
#else #else
Strcpy(hackdir, HACKDIR); Strcpy(g.hackdir, HACKDIR);
#endif #endif
if (argc > 1) { if (argc > 1) {
if (argcheck(argc, argv, ARG_VERSION) == 2) if (argcheck(argc, argv, ARG_VERSION) == 2)
@@ -317,7 +318,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
} }
if (!*dir) if (!*dir)
error("Flag -d must be followed by a directory name."); error("Flag -d must be followed by a directory name.");
Strcpy(hackdir, dir); Strcpy(g.hackdir, dir);
} }
if (argc > 1) { if (argc > 1) {
/* /*
@@ -326,7 +327,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
*/ */
if (!strncmp(argv[1], "-s", 2)) { if (!strncmp(argv[1], "-s", 2)) {
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(hackdir, 0); chdirx(g.hackdir, 0);
#endif #endif
#ifdef SYSCF #ifdef SYSCF
initoptions(); initoptions();
@@ -366,7 +367,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
* code parallel to other ports. * code parallel to other ports.
*/ */
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
chdirx(hackdir, 1); chdirx(g.hackdir, 1);
#endif #endif
#if defined(MSDOS) #if defined(MSDOS)