remove SYSFLAGS and MFLOPPY code
A check into github issue 364 confirmed that
ba6edbe5dc
had incorrectly updated the bwrite sizeof entry for sysflags.
The SYSFLAGS and MFLOPPY code is all in the outdated part of the tree, so just
remove it rather than re-correct it.
Closes #364
Closes #207
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 pcmain.c $NHDT-Date: 1543465755 2018/11/29 04:29:15 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.101 $ */
|
||||
/* NetHack 3.6 pcmain.c $NHDT-Date: 1593953369 2020/07/05 12:49:29 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.120 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -383,13 +383,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
process_options(argc, argv);
|
||||
#endif
|
||||
|
||||
#ifdef MFLOPPY
|
||||
set_lock_and_bones();
|
||||
#ifndef AMIGA
|
||||
copybones(FROMPERM);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* strip role,race,&c suffix; calls askname() if plname[] is empty
|
||||
or holds a generic user name like "player" or "games" */
|
||||
plnamesuffix();
|
||||
@@ -428,8 +421,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
Strcat(g.lock, g.plname);
|
||||
Strcat(g.lock, ".99");
|
||||
#else
|
||||
#ifndef MFLOPPY
|
||||
/* I'm not sure what, if anything, is left here, but MFLOPPY has
|
||||
/* I'm not sure what, if anything, is left here, but old MFLOPPY had
|
||||
* conflicts with set_lock_and_bones() in files.c.
|
||||
*/
|
||||
Strcpy(g.lock, g.plname);
|
||||
@@ -437,7 +429,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
regularize(g.lock); /* is this necessary? */
|
||||
/* not compatible with full path a la AMIGA */
|
||||
#endif
|
||||
#endif
|
||||
#endif /* PC_LOCKING */
|
||||
|
||||
/* Set up level 0 file to keep the game state.
|
||||
@@ -451,9 +442,6 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
write(nhfp->fd, (genericptr_t) &g.hackpid, sizeof(g.hackpid));
|
||||
close_nhfile(nhfp);
|
||||
}
|
||||
#ifdef MFLOPPY
|
||||
level_info[0].where = ACTIVE;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize the vision system. This must be before mklev() on a
|
||||
@@ -622,15 +610,6 @@ char *argv[];
|
||||
flags.initrace = i;
|
||||
}
|
||||
break;
|
||||
#ifdef MFLOPPY
|
||||
#ifndef AMIGA
|
||||
/* Player doesn't want to use a RAM disk
|
||||
*/
|
||||
case 'R':
|
||||
g.ramdisk = FALSE;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef AMIGA
|
||||
/* interlaced and non-interlaced screens */
|
||||
case 'L':
|
||||
@@ -687,11 +666,6 @@ nhusage()
|
||||
#ifndef AMIGA
|
||||
ADD_USAGE(" [-I] [-i] [-d]");
|
||||
#endif
|
||||
#ifdef MFLOPPY
|
||||
#ifndef AMIGA
|
||||
ADD_USAGE(" [-R]");
|
||||
#endif
|
||||
#endif
|
||||
#ifdef AMIGA
|
||||
ADD_USAGE(" [-[lL]]");
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 pcsys.c $NHDT-Date: 1524689500 2018/04/25 20:51:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.31 $ */
|
||||
/* NetHack 3.6 pcsys.c $NHDT-Date: 1593953370 2020/07/05 12:49:30 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.41 $ */
|
||||
/* Copyright (c) 2012 by Michael Allison */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -44,13 +44,6 @@ extern unsigned short __far __cdecl _movefpaused;
|
||||
#define __MOVE_PAUSE_CACHE 4 /* Represents the cache memory */
|
||||
#endif /* MOVERLAY */
|
||||
|
||||
#ifdef MFLOPPY
|
||||
static boolean NDECL(record_exists);
|
||||
#ifndef TOS
|
||||
static boolean NDECL(comspec_exists);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(MICRO)
|
||||
|
||||
void
|
||||
@@ -132,239 +125,6 @@ dosh()
|
||||
return 0;
|
||||
}
|
||||
#endif /* SHELL */
|
||||
|
||||
#ifdef MFLOPPY
|
||||
|
||||
void
|
||||
eraseall(path, files)
|
||||
const char *path, *files;
|
||||
{
|
||||
char buf[PATHLEN];
|
||||
char *foundfile;
|
||||
|
||||
foundfile = foundfile_buffer();
|
||||
Sprintf(buf, "%s%s", path, files);
|
||||
if (findfirst(buf))
|
||||
do {
|
||||
Sprintf(buf, "%s%s", path, foundfile);
|
||||
(void) unlink(buf);
|
||||
} while (findnext());
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Rewritten for version 3.3 to be faster
|
||||
*/
|
||||
void
|
||||
copybones(mode)
|
||||
int mode;
|
||||
{
|
||||
char from[PATHLEN], to[PATHLEN], last[13];
|
||||
char *frompath, *topath;
|
||||
char *foundfile;
|
||||
#ifndef TOS
|
||||
int status;
|
||||
char copy[8], *comspec;
|
||||
#endif
|
||||
|
||||
if (!g.ramdisk)
|
||||
return;
|
||||
|
||||
/* Find the name of the last file to be transferred
|
||||
*/
|
||||
frompath = (mode != TOPERM) ? g.permbones : g.levels;
|
||||
foundfile = foundfile_buffer();
|
||||
last[0] = '\0';
|
||||
Sprintf(from, "%s%s", frompath, g.allbones);
|
||||
topath = (mode == TOPERM) ? g.permbones : g.levels;
|
||||
#ifdef TOS
|
||||
eraseall(topath, g.allbones);
|
||||
#endif
|
||||
if (findfirst(from))
|
||||
do {
|
||||
#ifdef TOS
|
||||
Sprintf(from, "%s%s", frompath, foundfile);
|
||||
Sprintf(to, "%s%s", topath, foundfile);
|
||||
if (_copyfile(from, to))
|
||||
goto error_copying;
|
||||
#endif
|
||||
Strcpy(last, foundfile);
|
||||
} while (findnext());
|
||||
#ifdef TOS
|
||||
else
|
||||
return;
|
||||
#else
|
||||
if (last[0]) {
|
||||
Sprintf(copy, "%cC copy", switchar());
|
||||
|
||||
/* Remove any bones files in `to' directory.
|
||||
*/
|
||||
eraseall(topath, g.allbones);
|
||||
|
||||
/* Copy `from' to `to' */
|
||||
Sprintf(to, "%s%s", topath, g.allbones);
|
||||
comspec = getcomspec();
|
||||
status = spawnl(P_WAIT, comspec, comspec, copy, from, to, "> nul",
|
||||
(char *) 0);
|
||||
} else
|
||||
return;
|
||||
#endif /* TOS */
|
||||
|
||||
/* See if the last file got there. If so, remove the ramdisk bones
|
||||
* files.
|
||||
*/
|
||||
Sprintf(to, "%s%s", topath, last);
|
||||
if (findfirst(to)) {
|
||||
if (mode == TOPERM)
|
||||
eraseall(frompath, g.allbones);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef TOS
|
||||
error_copying:
|
||||
#endif
|
||||
/* Last file didn't get there.
|
||||
*/
|
||||
Sprintf(to, "%s%s", topath, g.allbones);
|
||||
msmsg("Can't copy \"%s\" to \"%s\" -- ", from, to);
|
||||
#ifndef TOS
|
||||
if (status < 0)
|
||||
msmsg("can't spawn \"%s\"!", comspec);
|
||||
else
|
||||
#endif
|
||||
msmsg((freediskspace(topath) < filesize(from))
|
||||
? "insufficient disk space."
|
||||
: "bad path(s)?");
|
||||
if (mode == TOPERM) {
|
||||
msmsg("Bones will be left in \"%s\"\n", *g.levels ? g.levels : hackdir);
|
||||
} else {
|
||||
/* Remove all bones files on the RAMdisk */
|
||||
eraseall(g.levels, g.allbones);
|
||||
playwoRAMdisk();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
playwoRAMdisk()
|
||||
{
|
||||
int c;
|
||||
|
||||
msmsg("Do you wish to play without a RAMdisk? [yn] (n)");
|
||||
|
||||
/* Set g.ramdisk false *before* exit-ing (because msexit calls
|
||||
* copybones)
|
||||
*/
|
||||
g.ramdisk = FALSE;
|
||||
c = tgetch();
|
||||
if (c == 'Y')
|
||||
c = 'y';
|
||||
if (c != 'y') {
|
||||
settty("Be seeing you...\n");
|
||||
nethack_exit(EXIT_SUCCESS);
|
||||
}
|
||||
set_lock_and_bones();
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
saveDiskPrompt(start)
|
||||
int start;
|
||||
{
|
||||
char buf[BUFSIZ], *bp;
|
||||
char qbuf[QBUFSZ];
|
||||
|
||||
int fd;
|
||||
|
||||
if (sysflags.asksavedisk) {
|
||||
/* Don't prompt if you can find the save file */
|
||||
if ((fd = open_savefile()) >= 0) {
|
||||
(void) nhclose(fd);
|
||||
return 1;
|
||||
}
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
pline("If save file is on a save disk, insert that disk now.");
|
||||
mark_synch();
|
||||
Sprintf(qbuf, "File name (default \"%s\"%s) ?", g.SAVEF,
|
||||
start ? "" : ", <Esc> cancels save");
|
||||
getlin(qbuf, buf);
|
||||
clear_nhwindow(WIN_MESSAGE);
|
||||
if (!start && *buf == '\033')
|
||||
return 0;
|
||||
|
||||
/* Strip any whitespace. Also, if nothing was entered except
|
||||
* whitespace, do not change the value of g.SAVEF.
|
||||
*/
|
||||
for (bp = buf; *bp; bp++)
|
||||
if (!isspace((uchar) *bp)) {
|
||||
strncpy(g.SAVEF, bp, PATHLEN);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return 1 if the record file was found */
|
||||
static boolean
|
||||
record_exists()
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen_datafile(RECORD, "r", TRUE);
|
||||
if (fp) {
|
||||
fclose(fp);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* MFLOPPY */
|
||||
|
||||
#ifdef TOS
|
||||
#define comspec_exists() 1
|
||||
#else
|
||||
#ifdef MFLOPPY
|
||||
/* Return 1 if the comspec was found */
|
||||
static boolean
|
||||
comspec_exists()
|
||||
{
|
||||
int fd;
|
||||
char *comspec;
|
||||
|
||||
if ((comspec = getcomspec()))
|
||||
if ((fd = open(comspec, O_RDONLY)) >= 0) {
|
||||
(void) nhclose(fd);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* MFLOPPY */
|
||||
#endif
|
||||
|
||||
#ifdef MFLOPPY
|
||||
/* Prompt for game disk, then check for record file.
|
||||
*/
|
||||
void
|
||||
gameDiskPrompt()
|
||||
{
|
||||
if (sysflags.asksavedisk) {
|
||||
if (record_exists() && comspec_exists())
|
||||
return;
|
||||
(void) putchar('\n');
|
||||
getreturn("when the game disk has been inserted");
|
||||
}
|
||||
if (comspec_exists() && record_exists())
|
||||
return;
|
||||
|
||||
if (!comspec_exists())
|
||||
msmsg("\n\nWARNING: can't find command processor \"%s\"!\n",
|
||||
getcomspec());
|
||||
if (!record_exists())
|
||||
msmsg("\n\nWARNING: can't find record file \"%s\"!\n", RECORD);
|
||||
msmsg("If the game disk is not in, insert it now.\n");
|
||||
getreturn("to continue");
|
||||
return;
|
||||
}
|
||||
#endif /* MFLOPPY */
|
||||
#endif /* MICRO */
|
||||
|
||||
/*
|
||||
@@ -503,10 +263,6 @@ msexit()
|
||||
#ifndef TOS
|
||||
enable_ctrlP(); /* in case this wasn't done */
|
||||
#endif
|
||||
#ifdef MFLOPPY
|
||||
if (g.ramdisk)
|
||||
copybones(TOPERM);
|
||||
#endif
|
||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
chdir(orgdir); /* chdir, not chdirx */
|
||||
chdrive(orgdir);
|
||||
|
||||
Reference in New Issue
Block a user