remove SYSFLAGS and MFLOPPY code
A check into github issue 364 confirmed that https://github.com/NetHack/NetHack/commit/ba6edbe5dcfbd27c03683e4d7aebf9593b24c5a7 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
-245
@@ -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