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:
nhmall
2020-07-05 08:50:13 -04:00
parent 84bba3f099
commit 5a437b336a
25 changed files with 63 additions and 881 deletions

View File

@@ -83,9 +83,6 @@ checkpoint save game state after each level change, for [TRUE]
Boolean option if NEWS was set at compile time:
news print any news from game administrator on startup [TRUE]
Boolean option if MFLOPPY was set at compile time:
checkspace check free disk space before writing files to disk [TRUE]
Boolean option if SCORE_ON_BOTL was set at compile time:
showscore display your approximate accumulated score [FALSE]

View File

@@ -1,4 +1,4 @@
.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.387 $ $NHDT-Date: 1593900593 2020/07/04 22:09:53 $
.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.388 $ $NHDT-Date: 1593953329 2020/07/05 12:48:49 $
.\"
.\" This is an excerpt from the 'roff' man page from the 'groff' package.
.\" Guidebook.mn currently does *not* fully adhere to these guidelines.
@@ -35,7 +35,7 @@
.ds vr "NetHack 3.7
.ds f0 "\*(vr
.ds f1
.ds f2 "July 2, 2020
.ds f2 "July 5, 2020
.
.\" A note on some special characters:
.\" \(lq = left double quote
@@ -3391,13 +3391,6 @@ for more details.
.lp checkpoint
Save game state after each level change, for possible recovery after
program crash (default on). Persistent.
.lp checkspace
Check free disk space before writing files to disk (default on).
You may have to turn this off if you have more than 2 GB free space
on the partition used for your save and level files
(because too much space might overflow the calculation and end up
looking like insufficient space).
Only applies when MFLOPPY was defined during compilation.
.lp clicklook
Allows looking at things on the screen by navigating the mouse
over them and clicking the right mouse button (default off).

View File

@@ -45,7 +45,7 @@
%.au
\author{Original version - Eric S. Raymond\\
(Edited and expanded for 3.7 by Mike Stephenson and others)}
\date{July 2, 2020}
\date{July 5, 2020}
\maketitle
@@ -3644,14 +3644,6 @@ synonym for ``{\it role\/}''. See {\it role\/} for more details.
Save game state after each level change, for possible recovery after
program crash (default on). Persistent.
%.lp
\item[\ib{checkspace}]
Check free disk space before writing files to disk (default on).
You may have to turn this off if you have more than 2 GB free space
on the partition used for your save and level files
(because too much space might overflow the calculation and end up
looking like insufficient space).
Only applies when MFLOPPY was defined during compilation.
%.lp
\item[\ib{clicklook}]
Allows looking at things on the screen by navigating the mouse
over them and clicking the right mouse button (default off).

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 decl.h $NHDT-Date: 1591017415 2020/06/01 13:16:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.237 $ */
/* NetHack 3.6 decl.h $NHDT-Date: 1593953331 2020/07/05 12:48:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.238 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2007. */
/* NetHack may be freely redistributed. See license for details. */
@@ -803,13 +803,6 @@ struct instance_globals {
#ifdef MICRO
char levels[PATHLEN]; /* where levels are */
#endif /* MICRO */
#ifdef MFLOPPY
char permbones[PATHLEN]; /* where permanent copy of bones go */
int ramdisk = FALSE; /* whether to copy bones to levels or not */
int saveprompt = TRUE;
const char *alllevels = "levels.*";
const char *allbones = "bones*.*";
#endif
struct sinfo program_state;
/* detect.c */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dungeon.h $NHDT-Date: 1447755969 2015/11/17 10:26:09 $ $NHDT-Branch: master $:$NHDT-Revision: 1.24 $ */
/* NetHack 3.6 dungeon.h $NHDT-Date: 1593953333 2020/07/05 12:48:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.38 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -167,15 +167,6 @@ struct linfo {
/* Note: VISITED and LFILE_EXISTS are currently almost always
* set at the same time. However they _mean_ different things.
*/
#ifdef MFLOPPY
#define FROMPERM 1 /* for ramdisk use */
#define TOPERM 2 /* for ramdisk use */
#define ACTIVE 1
#define SWAPPED 2
int where;
long time;
long size;
#endif /* MFLOPPY */
};
/* types and structures for dungeon map recording

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 extern.h $NHDT-Date: 1593771615 2020/07/03 10:20:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.849 $ */
/* NetHack 3.6 extern.h $NHDT-Date: 1593953334 2020/07/05 12:48:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.850 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -787,9 +787,6 @@ E char *FDECL(fname_encode, (const char *, CHAR_P, char *, char *, int));
E char *FDECL(fname_decode, (CHAR_P, char *, char *, int));
E const char *FDECL(fqname, (const char *, int, int));
E FILE *FDECL(fopen_datafile, (const char *, const char *, int));
#ifdef MFLOPPY
E void NDECL(set_lock_and_bones);
#endif
E void FDECL(zero_nhfile, (NHFILE *));
E void FDECL(close_nhfile, (NHFILE *));
E void FDECL(rewind_nhfile, (NHFILE *));
@@ -799,9 +796,6 @@ E NHFILE *FDECL(open_levelfile, (int, char *));
E void FDECL(delete_levelfile, (int));
E void NDECL(clearlocks);
E NHFILE *FDECL(create_bonesfile, (d_level *, char **, char *));
#ifdef MFLOPPY
E void NDECL(cancel_bonesfile);
#endif
E void FDECL(commit_bonesfile, (d_level *));
E NHFILE *FDECL(open_bonesfile, (d_level *, char **));
E int FDECL(delete_bonesfile, (d_level *));
@@ -1935,13 +1929,6 @@ E const char *NDECL(get_portable_device);
#if defined(MICRO) || defined(WIN32)
E void NDECL(flushout);
E int NDECL(dosh);
#ifdef MFLOPPY
E void FDECL(eraseall, (const char *, const char *));
E void FDECL(copybones, (int));
E void NDECL(playwoRAMdisk);
E int FDECL(saveDiskPrompt, (int));
E void NDECL(gameDiskPrompt);
#endif
E void FDECL(append_slash, (char *));
E void FDECL(getreturn, (const char *));
#ifndef AMIGA
@@ -2303,13 +2290,7 @@ E boolean FDECL(tricked_fileremoved, (NHFILE *, char *));
#ifdef INSURANCE
E void NDECL(savestateinlock);
#endif
#ifdef MFLOPPY
E boolean FDECL(savelev, (NHFILE *, XCHAR_P));
E boolean FDECL(swapin_file, (int));
E void NDECL(co_false);
#else
E void FDECL(savelev, (NHFILE *, XCHAR_P));
#endif
E genericptr_t FDECL(mon_to_buffer, (struct monst *, int *));
E boolean FDECL(close_check, (int));
E void FDECL(savecemetery, (NHFILE *, struct cemetery **));

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 flag.h $NHDT-Date: 1581637124 2020/02/13 23:38:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.176 $ */
/* NetHack 3.7 flag.h $NHDT-Date: 1593953335 2020/07/05 12:48:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.183 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -135,43 +135,6 @@ struct flag {
int runmode; /* update screen display during run moves */
};
/*
* System-specific flags that are saved with the game if SYSFLAGS is defined.
*/
#if defined(AMIFLUSH) || defined(AMII_GRAPHICS) || defined(OPT_DISPMAP)
#define SYSFLAGS
#else
#if defined(MFLOPPY) || defined(MAC)
#define SYSFLAGS
#endif
#endif
#ifdef SYSFLAGS
struct sysflag {
char sysflagsid[10];
#ifdef AMIFLUSH
boolean altmeta; /* use ALT keys as META */
boolean amiflush; /* kill typeahead */
#endif
#ifdef AMII_GRAPHICS
int numcols;
unsigned short
amii_dripens[20]; /* DrawInfo Pens currently there are 13 in v39 */
AMII_COLOR_TYPE amii_curmap[AMII_MAXCOLORS]; /* colormap */
#endif
#ifdef OPT_DISPMAP
boolean fast_map; /* use optimized, less flexible map display */
#endif
#ifdef MFLOPPY
boolean asksavedisk;
#endif
#ifdef MAC
boolean page_wait; /* put up a --More-- after a page of messages */
#endif
};
#endif
/*
* Flags that are set each time the game is started.
* These are not saved with the game.
@@ -289,11 +252,6 @@ struct instance_flags {
uchar bouldersym; /* symbol for boulder display */
char prevmsg_window; /* type of old message window to use */
boolean extmenu; /* extended commands use menu interface */
#ifdef MFLOPPY
boolean checkspace; /* check disk space before writing files */
/* (in iflags to allow restore after moving
* to >2GB partition) */
#endif
#ifdef MICRO
boolean BIOS; /* use IBM or ST BIOS calls when appropriate */
#endif
@@ -430,9 +388,6 @@ struct instance_flags {
#define preload_tiles wc_preload_tiles
extern NEARDATA struct flag flags;
#ifdef SYSFLAGS
extern NEARDATA struct sysflag sysflags;
#endif
extern NEARDATA struct instance_flags iflags;
/* last_msg values

View File

@@ -83,27 +83,8 @@ pfx_##a,
"status window alignment")
NHOPTC(altkeyhandler, 20, opt_in, set_in_game, No, Yes, No, No, NoAlias,
"alternate key handler")
#if defined(SYSFLAGS) && defined(AMIGA)
NHOPTB(altmeta, 0, opt_out, set_in_config, On, No, No, No, NoAlias,
&sysflags.altmeta)
#else
#ifdef ALTMETA
NHOPTB(altmeta, 0, opt_out, set_in_game, Off, No, No, No, NoAlias,
&iflags.altmeta)
#else
NHOPTB(altmeta, 0, opt_out, set_in_config, Off, No, No, No, NoAlias,
(boolean *) 0)
#endif
#endif
NHOPTB(ascii_map, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,
&iflags.wc_ascii_map)
#if defined(SYSFLAGS) && defined(MFLOPPY)
NHOPTB(asksavedisk, 0, opt_in, set_gameview, Off, No, No, No, NoAlias,
&sysflags.asksavedisk)
#else
NHOPTB(asksavedisk, 0, opt_in, set_gameview, Off, No, No, No, NoAlias,
(boolean *) 0)
#endif
NHOPTB(autodescribe, 0, opt_out, set_in_game, On, Yes, No, No, NoAlias,
&iflags.autodescribe)
NHOPTB(autodig, 0, opt_in, set_in_game, Off, Yes, No, No, NoAlias,

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pcconf.h $NHDT-Date: 1457207019 2016/03/05 19:43:39 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.19 $ */
/* NetHack 3.6 pcconf.h $NHDT-Date: 1593953338 2020/07/05 12:48:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.27 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2006. */
/* NetHack may be freely redistributed. See license for details. */
@@ -35,10 +35,6 @@
/*#define OVERLAY */ /* Manual overlay definition (MSC 6.0ax only) */
#ifndef __GO32__
#define MFLOPPY /* Support for floppy drives and ramdisks by dgk */
#endif
#define SHELL /* via exec of COMMAND.COM */
/*

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 allmain.c $NHDT-Date: 1584405115 2020/03/17 00:31:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.143 $ */
/* NetHack 3.6 allmain.c $NHDT-Date: 1593953342 2020/07/05 12:49:02 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.144 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -597,10 +597,6 @@ newgame()
{
int i;
#ifdef MFLOPPY
gameDiskPrompt();
#endif
g.context.botlx = TRUE;
g.context.ident = 1;
g.context.stethoscope_move = -1L;

View File

@@ -1,14 +1,10 @@
/* NetHack 3.6 bones.c $NHDT-Date: 1571363147 2019/10/18 01:45:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.76 $ */
/* NetHack 3.6 bones.c $NHDT-Date: 1593953344 2020/07/05 12:49:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.100 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#ifdef MFLOPPY
extern long bytes_counted;
#endif
static boolean FDECL(no_bones_level, (d_level *));
static void FDECL(goodfruit, (int));
static void FDECL(resetobjs, (struct obj *, BOOLEAN_P));
@@ -531,43 +527,6 @@ struct obj *corpse;
}
c = (char) (strlen(bonesid) + 1);
#ifdef MFLOPPY /* check whether there is room */
if (iflags.checkspace) {
int savemode = nhfp->mode;
nhfp->mode = COUNTING;
savelev(nhfp, ledger_no(&u.uz));
/* savelev() initializes bytes_counted to 0, so it must come
* first here even though it does not in the real save. the
* resulting extra bflush() at the end of savelev() may increase
* bytes_counted by a couple over what the real usage will be.
*
* note it is safe to call store_version() here only because
* bufon() is null for ZEROCOMP, which MFLOPPY uses -- otherwise
* this code would have to know the size of the version
* information itself.
*/
store_version(nhfp);
store_savefileinfo(nhfp);
if (nhfp->structlevel) {
bwrite(nhfp->fd, (genericptr_t) &c, sizeof c);
bwrite(nhfp->fd, (genericptr_t) bonesid, (unsigned) c); /* DD.nnn */
}
savefruitchn(nhfp);
if (nhfp->structlevel)
bflush(nhfp->fd);
if (bytes_counted > freediskspace(bones)) { /* not enough room */
if (wizard)
pline("Insufficient space to create bones file.");
close_nhfile(nhfp);
cancel_bonesfile();
return;
}
co_false(); /* make sure stuff before savelev() gets written */
nhfp->mode = savemode;
}
#endif /* MFLOPPY */
nhfp->mode = WRITING | FREEING;
store_version(nhfp);
store_savefileinfo(nhfp);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 decl.c $NHDT-Date: 1591017417 2020/06/01 13:16:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.213 $ */
/* NetHack 3.6 decl.c $NHDT-Date: 1593953345 2020/07/05 12:49:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.214 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
@@ -22,9 +22,6 @@ const schar zdir[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, -1 };
NEARDATA struct flag flags;
NEARDATA boolean has_strong_rngseed = FALSE;
#ifdef SYSFLAGS
NEARDATA struct sysflag sysflags;
#endif
NEARDATA struct instance_flags iflags;
NEARDATA struct you u;
NEARDATA time_t ubirthday;
@@ -349,13 +346,6 @@ const struct instance_globals g_init = {
#ifdef MICRO
UNDEFINED_VALUES, /* levels */
#endif /* MICRO */
#ifdef MFLOPPY
UNDEFINED_VALUES, /* permbones */
FALSE, /*ramdisk */
TRUE, /* saveprompt */
"levels.*", /* alllevels */
"bones*.*", /* allbones */
#endif
UNDEFINED_VALUES, /* program_state */
/* detect.c */
@@ -744,9 +734,6 @@ decl_globals_init()
g.subrooms = &g.rooms[MAXNROFROOMS + 1];
ZERO(flags);
#ifdef SYSFLAGS
ZERO(sysflags);
#endif
ZERO(iflags);
ZERO(u);
ZERO(ubirthday);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do.c $NHDT-Date: 1588191740 2020/04/29 20:22:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.243 $ */
/* NetHack 3.6 do.c $NHDT-Date: 1593953347 2020/07/05 12:49:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.246 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1157,9 +1157,6 @@ currentlevel_rewrite()
{
NHFILE *nhfp;
char whynot[BUFSZ];
#ifdef MFLOPPY
int savemode;
#endif
/* since level change might be a bit slow, flush any buffered screen
* output (like "you fall through a trap door") */
@@ -1178,18 +1175,6 @@ currentlevel_rewrite()
return (NHFILE *) 0;
}
#ifdef MFLOPPY
savemode = nhfp->mode;
nhfp->mode = COUNTING;
if (!savelev(nhfp, ledger_no(&u.uz))) {
close_nhfile(nhfp);
delete_levelfile(ledger_no(&u.uz));
pline("NetHack is out of disk space for making levels!");
You("can save, quit, or continue playing.");
return -1;
}
nhfp->mode = savemode;
#endif
return nhfp;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 files.c $NHDT-Date: 1590263451 2020/05/23 19:50:51 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.314 $ */
/* NetHack 3.7 files.c $NHDT-Date: 1593953349 2020/07/05 12:49:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.315 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -492,30 +492,6 @@ NHFILE *nhfp;
/* ---------- BEGIN LEVEL FILE HANDLING ----------- */
#ifdef MFLOPPY
/* Set names for bones[] and lock[] */
void
set_lock_and_bones()
{
if (!g.ramdisk) {
Strcpy(levels, g.permbones);
Strcpy(g.bones, g.permbones);
}
append_slash(g.permbones);
append_slash(g.levels);
#ifdef AMIGA
strncat(levels, bbs_id, PATHLEN);
#endif
append_slash(g.bones);
Strcat(g.bones, "bonesnn.*");
Strcpy(g.lock, g.levels);
#ifndef AMIGA
Strcat(g.lock, g.alllevels);
#endif
return;
}
#endif /* MFLOPPY */
/* Construct a file name for a level-type file, which is of the form
* something.level (with any old level stripped off).
* This assumes there is space on the end of 'file' to append
@@ -598,11 +574,6 @@ char errbuf[];
*errbuf = '\0';
set_levelfile_name(g.lock, lev);
fq_lock = fqname(g.lock, LEVELPREFIX, 0);
#ifdef MFLOPPY
/* If not currently accessible, swap it in. */
if (g.level_info[lev].where != ACTIVE)
swapin_file(lev);
#endif
nhfp = new_nhfile();
if (nhfp) {
nhfp->mode = READING;
@@ -651,29 +622,21 @@ int lev;
void
clearlocks()
{
int x;
#ifdef HANGUPHANDLING
if (g.program_state.preserve_locks)
return;
#endif
#if !defined(PC_LOCKING) && defined(MFLOPPY) && !defined(AMIGA)
eraseall(levels, g.alllevels);
if (g.ramdisk)
eraseall(g.permbones, g.alllevels);
#else
{
register int x;
#ifndef NO_SIGNAL
(void) signal(SIGINT, SIG_IGN);
(void) signal(SIGINT, SIG_IGN);
#endif
#if defined(UNIX) || defined(VMS)
sethanguphandler((void FDECL((*), (int) )) SIG_IGN);
sethanguphandler((void FDECL((*), (int) )) SIG_IGN);
#endif
/* can't access maxledgerno() before dungeons are created -dlc */
for (x = (g.n_dgns ? maxledgerno() : 0); x >= 0; x--)
delete_levelfile(x); /* not all levels need be present */
}
#endif /* ?PC_LOCKING,&c */
/* can't access maxledgerno() before dungeons are created -dlc */
for (x = (g.n_dgns ? maxledgerno() : 0); x >= 0; x--)
delete_levelfile(x); /* not all levels need be present */
}
#if defined(SELECTSAVED)
@@ -847,19 +810,6 @@ char errbuf[];
return nhfp;
}
#ifdef MFLOPPY
/* remove partial bonesfile in process of creation */
void
cancel_bonesfile()
{
const char *tempname;
tempname = set_bonestemp_name();
tempname = fqname(tempname, BONESPREFIX, 0);
(void) unlink(tempname);
}
#endif /* MFLOPPY */
/* move completed bones file to proper name */
void
commit_bonesfile(lev)
@@ -1201,10 +1151,6 @@ restore_saved_game()
NHFILE *nhfp = (NHFILE *) 0;
set_savefile_name(TRUE);
#ifdef MFLOPPY
if (!saveDiskPrompt(1))
return -1;
#endif /* MFLOPPY */
fq_save = fqname(g.SAVEF, SAVEPREFIX, 0);
nh_uncompress(fq_save);
@@ -2087,10 +2033,6 @@ const char *fname;
configfile[sizeof configfile - 1] = '\0';
}
#ifndef MFLOPPY
#define fopenp fopen
#endif
static FILE *
fopen_config_file(filename, src)
const char *filename;
@@ -2106,7 +2048,7 @@ int src;
/* SYSCF_FILE; if we can't open it, caller will bail */
if (filename && *filename) {
set_configfile_name(fqname(filename, SYSCONFPREFIX, 0));
fp = fopenp(configfile, "r");
fp = fopen(configfile, "r");
} else
fp = (FILE *) 0;
return fp;
@@ -2130,7 +2072,7 @@ int src;
/* fall through to standard names */
} else
#endif
if ((fp = fopenp(configfile, "r")) != (FILE *) 0) {
if ((fp = fopen(configfile, "r")) != (FILE *) 0) {
return fp;
#if defined(UNIX) || defined(VMS)
} else {
@@ -2145,20 +2087,20 @@ int src;
#if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32)
set_configfile_name(fqname(default_configfile, CONFIGPREFIX, 0));
if ((fp = fopenp(configfile, "r")) != (FILE *) 0) {
if ((fp = fopen(configfile, "r")) != (FILE *) 0) {
return fp;
} else if (strcmp(default_configfile, configfile)) {
set_configfile_name(default_configfile);
if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
return fp;
}
#ifdef MSDOS
set_configfile_name(fqname(backward_compat_configfile, CONFIGPREFIX, 0));
if ((fp = fopenp(configfile, "r")) != (FILE *) 0) {
if ((fp = fopen(configfile, "r")) != (FILE *) 0) {
return fp;
} else if (strcmp(backward_compat_configfile, configfile)) {
set_configfile_name(backward_compat_configfile);
if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
return fp;
}
#endif
@@ -2167,10 +2109,10 @@ int src;
#ifdef VMS
/* no punctuation, so might be a logical name */
set_configfile_name("nethackini");
if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
return fp;
set_configfile_name("sys$login:nethack.ini");
if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
return fp;
envp = nh_getenv("HOME");
@@ -2181,7 +2123,7 @@ int src;
!index(":]>/", envp[strlen(envp) - 1]) ? "/" : "",
"NetHack.cnf");
set_configfile_name(tmp_config);
if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
return fp;
#else /* should be only UNIX left */
envp = nh_getenv("HOME");
@@ -2191,7 +2133,7 @@ int src;
Sprintf(tmp_config, "%s/%s", envp, ".nethackrc");
set_configfile_name(tmp_config);
if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
return fp;
#if defined(__APPLE__) /* UNIX+__APPLE__ => MacOSX */
/* try an alternative */
@@ -2200,13 +2142,13 @@ int src;
Sprintf(tmp_config, "%s/%s", envp,
"Library/Preferences/NetHack Defaults");
set_configfile_name(tmp_config);
if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
return fp;
/* may be easier for user to edit if filename has '.txt' suffix */
Sprintf(tmp_config, "%s/%s", envp,
"Library/Preferences/NetHack Defaults.txt");
set_configfile_name(tmp_config);
if ((fp = fopenp(configfile, "r")) != (FILE *) 0)
if ((fp = fopen(configfile, "r")) != (FILE *) 0)
return fp;
}
#endif /*__APPLE__*/
@@ -2507,19 +2449,6 @@ char *origbuf;
#ifdef MICRO
} else if (match_varname(buf, "HACKDIR", 4)) {
(void) strncpy(g.hackdir, bufp, PATHLEN - 1);
#ifdef MFLOPPY
} else if (match_varname(buf, "RAMDISK", 3)) {
/* The following ifdef is NOT in the wrong
* place. For now, we accept and silently
* ignore RAMDISK */
#ifndef AMIGA
if (strlen(bufp) >= PATHLEN)
bufp[PATHLEN - 1] = '\0';
Strcpy(levels, bufp);
g.ramdisk = (strcmp(g.permbones, levels) != 0);
ramdisk_specified = TRUE;
#endif
#endif
} else if (match_varname(buf, "LEVELS", 4)) {
if (strlen(bufp) >= PATHLEN)
bufp[PATHLEN - 1] = '\0';
@@ -2532,16 +2461,7 @@ char *origbuf;
if ((ptr = index(bufp, ';')) != 0) {
*ptr = '\0';
#ifdef MFLOPPY
if (*(ptr + 1) == 'n' || *(ptr + 1) == 'N') {
g.saveprompt = FALSE;
}
#endif
}
#if defined(SYSFLAGS) && defined(MFLOPPY)
else
g.saveprompt = sysflags.asksavedisk;
#endif
(void) strncpy(g.SAVEP, bufp, SAVESIZE - 1);
append_slash(g.SAVEP);
@@ -2788,17 +2708,6 @@ char *origbuf;
int val = atoi(bufp);
amii_numcolors = 1L << min(DEPTH, val);
#ifdef SYSFLAGS
} else if (match_varname(buf, "DRIPENS", 7)) {
int i, val;
char *t;
for (i = 0, t = strtok(bufp, ",/"); t != (char *) 0;
i < 20 && (t = strtok((char *) 0, ",/")), ++i) {
sscanf(t, "%d", &val);
sysflags.amii_dripens[i] = val;
}
#endif
} else if (match_varname(buf, "SCREENMODE", 10)) {
extern long amii_scrnmode;
@@ -3103,7 +3012,7 @@ fopen_wizkit_file()
/* fall through to standard names */
} else
#endif
if ((fp = fopenp(g.wizkit, "r")) != (FILE *) 0) {
if ((fp = fopen(g.wizkit, "r")) != (FILE *) 0) {
return fp;
#if defined(UNIX) || defined(VMS)
} else {
@@ -3115,7 +3024,7 @@ fopen_wizkit_file()
}
#if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32)
if ((fp = fopenp(fqname(g.wizkit, CONFIGPREFIX, 0), "r")) != (FILE *) 0)
if ((fp = fopen(fqname(g.wizkit, CONFIGPREFIX, 0), "r")) != (FILE *) 0)
return fp;
#else
#ifdef VMS
@@ -3124,7 +3033,7 @@ fopen_wizkit_file()
Sprintf(tmp_wizkit, "%s%s", envp, g.wizkit);
else
Sprintf(tmp_wizkit, "%s%s", "sys$login:", g.wizkit);
if ((fp = fopenp(tmp_wizkit, "r")) != (FILE *) 0)
if ((fp = fopen(tmp_wizkit, "r")) != (FILE *) 0)
return fp;
#else /* should be only UNIX left */
envp = nh_getenv("HOME");
@@ -3132,7 +3041,7 @@ fopen_wizkit_file()
Sprintf(tmp_wizkit, "%s/%s", envp, g.wizkit);
else
Strcpy(tmp_wizkit, g.wizkit);
if ((fp = fopenp(tmp_wizkit, "r")) != (FILE *) 0)
if ((fp = fopen(tmp_wizkit, "r")) != (FILE *) 0)
return fp;
else if (errno != ENOENT) {
/* e.g., problems when setuid NetHack can't search home
@@ -3728,7 +3637,7 @@ const char *dir UNUSED_if_not_OS2_CODEVIEW;
char tmp[PATHLEN];
#ifdef OS2_CODEVIEW /* explicit path on opening for OS/2 */
/* how does this work when there isn't an explicit path or fopenp
/* how does this work when there isn't an explicit path or fopen
* for later access to the file via fopen_datafile? ? */
(void) strncpy(tmp, dir, PATHLEN - 1);
tmp[PATHLEN - 1] = '\0';

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 mdlib.c $NHDT-Date: 1575161954 2019/12/01 00:59:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.6 $ */
/* NetHack 3.7 mdlib.c $NHDT-Date: 1593953352 2020/07/05 12:49:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.9 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
/* Copyright (c) M. Stephenson, 1990, 1991. */
@@ -228,13 +228,8 @@ make_version()
| ((unsigned long) sizeof(struct obj) << 17)
| ((unsigned long) sizeof(struct monst) << 10)
| ((unsigned long) sizeof(struct you)));
version.struct_sizes2 = (((unsigned long) sizeof(struct flag) << 10) |
version.struct_sizes2 = (((unsigned long) sizeof(struct flag) << 10));
/* free bits in here */
#ifdef SYSFLAGS
((unsigned long) sizeof(struct sysflag)));
#else
((unsigned long) 0L));
#endif
return;
}
@@ -439,9 +434,6 @@ static const char *build_opts[] = {
#if defined(MSGHANDLER) && (defined(POSIX_TYPES) || defined(__GNUC__))
"external program as a message handler",
#endif
#ifdef MFLOPPY
"floppy drive support",
#endif
#ifdef INSURANCE
"insurance files for recovering from crashes",
#endif

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 options.c $NHDT-Date: 1591476281 2020/06/06 20:44:41 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.466 $ */
/* NetHack 3.7 options.c $NHDT-Date: 1593953355 2020/07/05 12:49:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.467 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -8,9 +8,6 @@
#include "objclass.h"
#include "flag.h"
NEARDATA struct flag flags; /* provide linkage */
#ifdef SYSFLAGS
NEARDATA struct sysflag sysflags; /* provide linkage */
#endif
NEARDATA struct instance_flags iflags; /* provide linkage */
#define static
#else
@@ -5989,10 +5986,6 @@ initoptions_init()
*(allopt[i].addr) = allopt[i].initval;
}
#ifdef SYSFLAGS
Strcpy(sysflags.sysflagsid, "sysflags");
sysflags.sysflagsid[9] = (char) sizeof (struct sysflag);
#endif
flags.end_own = FALSE;
flags.end_top = 3;
flags.end_around = 2;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 restore.c $NHDT-Date: 1581886865 2020/02/16 21:01:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.163 $ */
/* NetHack 3.7 restore.c $NHDT-Date: 1593953357 2020/07/05 12:49:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.166 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
@@ -33,7 +33,7 @@ static void FDECL(freefruitchn, (struct fruit *));
static void FDECL(ghostfruit, (struct obj *));
static boolean FDECL(restgamestate, (NHFILE *, unsigned int *, unsigned int *));
static void FDECL(restlevelstate, (unsigned int, unsigned int));
static int FDECL(restlevelfile, (NHFILE *, XCHAR_P));
static int FDECL(restlevelfile, (XCHAR_P));
static void FDECL(restore_msghistory, (NHFILE *));
static void FDECL(reset_oattached_mids, (BOOLEAN_P));
static void FDECL(rest_levl, (NHFILE *, BOOLEAN_P));
@@ -548,9 +548,6 @@ NHFILE *nhfp;
unsigned int *stuckid, *steedid;
{
struct flag newgameflags;
#ifdef SYSFLAGS
struct sysflag newgamesysflags;
#endif
struct context_info newgamecontext; /* all 0, but has some pointers */
struct obj *otmp;
struct obj *bc_obj;
@@ -608,12 +605,6 @@ unsigned int *stuckid, *steedid;
/* specified by save file; check authorization now */
set_playmode();
}
#ifdef SYSFLAGS
newgamesysflags = sysflags;
if (nhfp->structlevel)
mread(nhfp->fd, (genericptr_t) &sysflags, sizeof(struct sysflag));
#endif
role_init(); /* Reset the initial role, race, gender, and alignment */
#ifdef AMII_GRAPHICS
amii_setpens(amii_numcolors); /* use colors from save file */
@@ -654,9 +645,6 @@ unsigned int *stuckid, *steedid;
iflags.deferred_X = FALSE;
iflags.perm_invent = defer_perm_invent;
flags = newgameflags;
#ifdef SYSFLAGS
sysflags = newgamesysflags;
#endif
g.context = newgamecontext;
g.youmonst = cg.zeromonst;
return FALSE;
@@ -776,66 +764,22 @@ unsigned int stuckid, steedid;
/*ARGSUSED*/
static int
restlevelfile(nhfp, ltmp)
NHFILE *nhfp; /* used in MFLOPPY only */
restlevelfile(ltmp)
xchar ltmp;
{
char whynot[BUFSZ];
#ifdef MFLOPPY
int savemode;
#endif
NHFILE *nnhfp = (NHFILE *) 0;
NHFILE *nhfp = (NHFILE *) 0;
#ifndef MFLOPPY
nhUse(nhfp);
#endif
nnhfp = create_levelfile(ltmp, whynot);
if (!nnhfp) {
nhfp = create_levelfile(ltmp, whynot);
if (!nhfp) {
/* BUG: should suppress any attempt to write a panic
save file if file creation is now failing... */
panic("restlevelfile: %s", whynot);
}
#ifdef MFLOPPY
savemode = nnhfp->mode;
nnhfp->mode = COUNTING;
if (!savelev(nnhfp, ltmp)) {
/* The savelev can't proceed because the size required
* is greater than the available disk space.
*/
pline("Not enough space on `%s' to restore your game.", levels);
/* Remove levels and bones that may have been created.
*/
close_nhfile(nnhfp);
#ifdef AMIGA
clearlocks();
#else /* !AMIGA */
eraseall(levels, g.alllevels);
eraseall(levels, g.allbones);
/* Perhaps the person would like to play without a
* RAMdisk.
*/
if (g.ramdisk) {
/* PlaywoRAMdisk may not return, but if it does
* it is certain that g.ramdisk will be 0.
*/
playwoRAMdisk();
/* Rewind save file and try again */
rewind_nhfile(nhfp);
(void) validate(nhfp, (char *) 0); /* skip version etc */
return dorecover(nhfp); /* 0 or 1 */
}
#endif /* ?AMIGA */
pline("Be seeing you...");
nh_terminate(EXIT_SUCCESS);
}
nnhfp->mode = savemode;
#endif /* MFLOPPY */
bufon(nnhfp->fd);
nnhfp->mode = WRITING | FREEING;
savelev(nnhfp, ltmp);
close_nhfile(nnhfp);
bufon(nhfp->fd);
nhfp->mode = WRITING | FREEING;
savelev(nhfp, ltmp);
close_nhfile(nhfp);
return 2;
}
@@ -870,7 +814,7 @@ NHFILE *nhfp;
#ifdef INSURANCE
savestateinlock();
#endif
rtmp = restlevelfile(nhfp, ledger_no(&u.uz));
rtmp = restlevelfile(ledger_no(&u.uz));
if (rtmp < 2)
return rtmp; /* dorecover called recursively */
@@ -924,7 +868,7 @@ NHFILE *nhfp;
}
mark_synch();
#endif
rtmp = restlevelfile(nhfp, ltmp);
rtmp = restlevelfile(ltmp);
if (rtmp < 2)
return rtmp; /* dorecover called recursively */
}
@@ -944,9 +888,6 @@ NHFILE *nhfp;
assign_graphics(ROGUESET);
#ifdef USE_TILES
substitute_tiles(&u.uz);
#endif
#ifdef MFLOPPY
gameDiskPrompt();
#endif
max_rank_sz(); /* to recompute g.mrank_sz (botl.c) */
/* take care of iron ball & chain */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 save.c $NHDT-Date: 1590263454 2020/05/23 19:50:54 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.158 $ */
/* NetHack 3.6 save.c $NHDT-Date: 1593953359 2020/07/05 12:49:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.159 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
@@ -12,11 +12,6 @@
#include <fcntl.h>
#endif
#ifdef MFLOPPY
long bytes_counted;
static int count_only;
#endif
#if defined(UNIX) || defined(WIN32)
#define USE_BUFFERING
#endif
@@ -39,12 +34,6 @@ static void FDECL(savetrapchn, (NHFILE *,struct trap *));
static void FDECL(savegamestate, (NHFILE *));
static void FDECL(save_msghistory, (NHFILE *));
#ifdef MFLOPPY
static void FDECL(savelev0, (NHFILE *, XCHAR_P, int));
static boolean NDECL(swapout_oldest);
static void FDECL(copyfile, (char *, char *));
#endif /* MFLOPPY */
#ifdef ZEROCOMP
static void FDECL(zerocomp_bufon, (int));
static void FDECL(zerocomp_bufoff, (int));
@@ -119,11 +108,6 @@ dosave0()
(void) signal(SIGINT, SIG_IGN);
#endif
#if defined(MICRO) && defined(MFLOPPY)
if (!saveDiskPrompt(0))
return 0;
#endif
HUP if (iflags.window_inited) {
nh_uncompress(fq_save);
nhfp = open_savefile();
@@ -165,36 +149,6 @@ dosave0()
if (!WINDOWPORT("X11"))
putstr(WIN_MAP, 0, "Saving:");
#endif
#ifdef MFLOPPY
/* make sure there is enough disk space */
if (iflags.checkspace) {
long fds, needed;
nhfp->mode = COUNTING;
savelev(nhfp, ledger_no(&u.uz));
savegamestate(nhfp);
needed = bytes_counted;
for (ltmp = 1; ltmp <= maxledgerno(); ltmp++)
if (ltmp != ledger_no(&u.uz) && g.level_info[ltmp].where)
needed += g.level_info[ltmp].size + (sizeof ltmp);
fds = freediskspace(fq_save);
if (needed > fds) {
HUP
{
There("is insufficient space on SAVE disk.");
pline("Require %ld bytes but only have %ld.", needed, fds);
}
flushout();
close_nhfile(nhfp);
(void) delete_savefile();
return 0;
}
co_false();
}
#endif /* MFLOPPY */
nhfp->mode = WRITING | FREEING;
store_version(nhfp);
store_savefileinfo(nhfp);
@@ -272,17 +226,11 @@ NHFILE *nhfp;
unsigned long uid;
struct obj * bc_objs = (struct obj *)0;
#ifdef MFLOPPY
count_only = (nhfp->mode & COUNTING);
#endif
uid = (unsigned long) getuid();
if (nhfp->structlevel) {
bwrite(nhfp->fd, (genericptr_t) &uid, sizeof uid);
bwrite(nhfp->fd, (genericptr_t) &g.context, sizeof g.context);
bwrite(nhfp->fd, (genericptr_t) &flags, sizeof flags);
#ifdef SYSFLAGS
bwrite(nhfp->fd, (genericptr_t) &sysflags, sysflags);
#endif
}
urealtime.finish_time = getnow();
urealtime.realtime += (long) (urealtime.finish_time
@@ -443,44 +391,8 @@ savestateinlock()
}
#endif
#ifdef MFLOPPY
boolean
savelev(nhfp, lev)
NHFILE *nhfp;
xchar lev;
{
if (nhfp->mode & COUNTING) {
int savemode = nhfp->mode;
bytes_counted = 0;
savelev0(nhfp, lev);
/* probably bytes_counted will be filled in again by an
* immediately following WRITE_SAVE anyway, but we'll
* leave it out of checkspace just in case */
if (iflags.checkspace) {
while (bytes_counted > freediskspace(levels))
if (!swapout_oldest())
return FALSE;
}
}
if (nhfp->mode & (WRITING | FREEING)) {
bytes_counted = 0;
savelev0(nhfp, lev);
}
if (nhfp->mode != FREEING) {
g.level_info[lev].where = ACTIVE;
g.level_info[lev].time = g.moves;
g.level_info[lev].size = bytes_counted;
}
return TRUE;
}
static void
savelev0(nhfp, lev)
#else
void
savelev(nhfp, lev)
#endif
NHFILE *nhfp;
xchar lev;
{
@@ -516,9 +428,6 @@ xchar lev;
if (!nhfp)
panic("Save on bad file!"); /* impossible */
#ifdef MFLOPPY
count_only = (nhfp->mode & COUNTING);
#endif
if (lev >= 0 && lev <= maxledgerno())
g.level_info[lev].flags |= VISITED;
if (nhfp->structlevel)
@@ -1167,97 +1076,4 @@ freedynamicdata()
return;
}
#ifdef MFLOPPY
boolean
swapin_file(lev)
int lev;
{
char to[PATHLEN], from[PATHLEN];
Sprintf(from, "%s%s", g.permbones, g.alllevels);
Sprintf(to, "%s%s", levels, g.alllevels);
set_levelfile_name(from, lev);
set_levelfile_name(to, lev);
if (iflags.checkspace) {
while (g.level_info[lev].size > freediskspace(to))
if (!swapout_oldest())
return FALSE;
}
if (wizard) {
pline("Swapping in `%s'.", from);
wait_synch();
}
copyfile(from, to);
(void) unlink(from);
g.level_info[lev].where = ACTIVE;
return TRUE;
}
static boolean
swapout_oldest()
{
char to[PATHLEN], from[PATHLEN];
int i, oldest;
long oldtime;
if (!g.ramdisk)
return FALSE;
for (i = 1, oldtime = 0, oldest = 0; i <= maxledgerno(); i++)
if (g.level_info[i].where == ACTIVE
&& (!oldtime || g.level_info[i].time < oldtime)) {
oldest = i;
oldtime = g.level_info[i].time;
}
if (!oldest)
return FALSE;
Sprintf(from, "%s%s", levels, g.alllevels);
Sprintf(to, "%s%s", g.permbones, g.alllevels);
set_levelfile_name(from, oldest);
set_levelfile_name(to, oldest);
if (wizard) {
pline("Swapping out `%s'.", from);
wait_synch();
}
copyfile(from, to);
(void) unlink(from);
g.level_info[oldest].where = SWAPPED;
return TRUE;
}
static void
copyfile(from, to)
char *from, *to;
{
#ifdef TOS
if (_copyfile(from, to))
panic("Can't copy %s to %s", from, to);
#else
char buf[BUFSIZ]; /* this is system interaction, therefore
* BUFSIZ instead of NetHack's BUFSZ */
int nfrom, nto, fdfrom, fdto;
if ((fdfrom = open(from, O_RDONLY | O_BINARY, FCMASK)) < 0)
panic("Can't copy from %s !?", from);
if ((fdto = open(to, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FCMASK)) < 0)
panic("Can't copy to %s", to);
do {
nfrom = read(fdfrom, buf, BUFSIZ);
nto = write(fdto, buf, nfrom);
if (nto != nfrom)
panic("Copyfile failed!");
} while (nfrom == BUFSIZ);
(void) nhclose(fdfrom);
(void) nhclose(fdto);
#endif /* TOS */
}
/* see comment in bones.c */
void
co_false()
{
count_only = FALSE;
return;
}
#endif /* MFLOPPY */
/*save.c*/

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 sfstruct.c $NHDT-Date: 1559994625 2019/06/08 11:50:25 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.121 $ */
/* NetHack 3.7 sfstruct.c $NHDT-Date: 1593953360 2020/07/05 12:49:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.3 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2009. */
/* NetHack may be freely redistributed. See license for details. */
@@ -212,11 +212,6 @@ register unsigned num;
int idx = getidx(fd, NOFLG);
if (idx >= 0) {
#ifdef MFLOPPY
bytes_counted += num;
if (count_only)
return;
#endif
#ifdef USE_BUFFERING
if (bw_buffered[idx] && bw_FILE[idx]) {
failed = (fwrite(loc, (int) num, 1, bw_FILE[idx]) != 1);

View File

@@ -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

View File

@@ -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);

View File

@@ -1,5 +1,5 @@
#!perl
# NetHack 3.6 mdgrep.pl $NHDT-Date: 1524684408 2018/04/25 19:26:48 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.16 $
# NetHack 3.6 mdgrep.pl $NHDT-Date: 1593953364 2020/07/05 12:49:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.19 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details.
@@ -43,7 +43,7 @@
# GCC_WARN VOIDYYPUT FLEX_SCANNER FLEXHACK_SCANNER WIERD_LEX
# NeXT __osf__ SVR4 _AIX32 _BULL_SOURCE AUX __sgi GNUDOS
# TIMED_DELAY DEF_MAILREADER DEF_PAGER NO_SIGNAL PC_LOCKING LATTICE __GO32__
# msleep NO_FILE_LINKS bsdi HPUX AMIFLUSH SYSFLAGS
# msleep NO_FILE_LINKS bsdi HPUX AMIFLUSH
# OVERLAY USE_TRAMPOLI USE_OVLx SPEC_LEV DGN_COMP
# SCREEN_BIOS SCREEN_DJGPPFAST SCREEN_VGA SCREEN_8514
# EXEPATH NOTSTDC SELECTSAVED NOTPARMDECL
@@ -54,10 +54,10 @@
$outfile = "mdgrep.h";
sub start_file {
($rev) = ('$NHDT-Revision: 1.16 $') =~ m/: (.*) .$/;
my $date = '$NHDT-Date: 1524684408 2018/04/25 19:26:48 $';
my $branch = '$NHDT-Branch: NetHack-3.6.0 $';
my $revision = '$NHDT-Revision: 1.16 $';
($rev) = ('$NHDT-Revision: 1.19 $') =~ m/: (.*) .$/;
my $date = '$NHDT-Date: 1593953366 2020/07/05 12:49:26 $';
my $branch = '$NHDT-Branch: NetHack-3.7 $';
my $revision = '$NHDT-Revision: 1.19 $';
open(OUT, ">$outfile") || die "open $outfile: $!";
# NB: Date and Revision below will be modified when mdgrep.h is written to
# git - this is correct (but it means you must commit changes to mdgrep.pl