globals from files.c moved to instance globals.
This commit is contained in:
+58
-5
@@ -8,9 +8,54 @@
|
|||||||
|
|
||||||
#define E extern
|
#define E extern
|
||||||
|
|
||||||
E char SAVEF[];
|
#if !defined(MFLOPPY) && !defined(VMS) && !defined(WIN32)
|
||||||
#ifdef MICRO
|
#define LOCKNAMESIZE (PL_NSIZ + 14) /* long enough for uid+name+.99 */
|
||||||
E char SAVEP[];
|
#define LOCKNAMEINIT "1lock"
|
||||||
|
#define BONESINIT "bonesnn.xxx"
|
||||||
|
#define BONESSIZE sizeof(BONESINIT)
|
||||||
|
#else
|
||||||
|
#if defined(MFLOPPY)
|
||||||
|
#define LOCKNAMESIZE FILENAME
|
||||||
|
#define LOCKNAMEINIT ""
|
||||||
|
#define BONESINIT ""
|
||||||
|
#define BONESSIZE FILENAME
|
||||||
|
#endif
|
||||||
|
#if defined(VMS)
|
||||||
|
#define LOCKNAMESIZE (PL_NSIZ + 17) /* long enough for _uid+name+.99;1 */
|
||||||
|
#define LOCKNAMEINIT "1lock"
|
||||||
|
#define BONESINIT "bonesnn.xxx;1"
|
||||||
|
#define BONESSIZE sizeof(BONESINIT)
|
||||||
|
#endif
|
||||||
|
#if defined(WIN32)
|
||||||
|
#define LOCKNAMESIZE (PL_NSIZ + 25) /* long enough for username+-+name+.99 */
|
||||||
|
#define LOCKNAMEINIT ""
|
||||||
|
#define BONESINIT "bonesnn.xxx"
|
||||||
|
#define BONESSIZE sizeof(BONESINIT)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(UNIX) || defined(__BEOS__)
|
||||||
|
#define SAVESIZE (PL_NSIZ + 13) /* save/99999player.e */
|
||||||
|
#else
|
||||||
|
#ifdef VMS
|
||||||
|
#define SAVESIZE (PL_NSIZ + 22) /* [.save]<uid>player.e;1 */
|
||||||
|
#else
|
||||||
|
#if defined(WIN32)
|
||||||
|
#define SAVESIZE (PL_NSIZ + 40) /* username-player.NetHack-saved-game */
|
||||||
|
#else
|
||||||
|
#define SAVESIZE FILENAME /* from macconf.h or pcconf.h */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* used in files.c */
|
||||||
|
#ifdef HOLD_LOCKFILE_OPEN
|
||||||
|
struct level_ftrack {
|
||||||
|
int init;
|
||||||
|
int fd; /* file descriptor for level file */
|
||||||
|
int oflag; /* open flags */
|
||||||
|
boolean nethack_thinks_it_is_open; /* Does NetHack think it's open? */
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* max size of a windowtype option */
|
/* max size of a windowtype option */
|
||||||
@@ -137,8 +182,6 @@ struct kinfo {
|
|||||||
char name[BUFSZ]; /* actual killer name */
|
char name[BUFSZ]; /* actual killer name */
|
||||||
};
|
};
|
||||||
|
|
||||||
E char lock[];
|
|
||||||
|
|
||||||
E const schar xdir[], ydir[], zdir[];
|
E const schar xdir[], ydir[], zdir[];
|
||||||
|
|
||||||
struct multishot {
|
struct multishot {
|
||||||
@@ -796,6 +839,16 @@ struct instance_globals {
|
|||||||
boolean chosen_symset_start;
|
boolean chosen_symset_start;
|
||||||
boolean chosen_symset_end;
|
boolean chosen_symset_end;
|
||||||
int symset_which_set;
|
int symset_which_set;
|
||||||
|
#ifdef HOLD_LOCKFILE_OPEN
|
||||||
|
struct level_ftrack lftrack;
|
||||||
|
#endif /*HOLD_LOCKFILE_OPEN*/
|
||||||
|
char SAVEF[SAVESIZE]; /* holds relative path of save file from playground */
|
||||||
|
#ifdef MICRO
|
||||||
|
char SAVEP[SAVESIZE]; /* holds path of directory for save file */
|
||||||
|
#endif
|
||||||
|
char bones[BONESSIZE];
|
||||||
|
char lock[LOCKNAMESIZE];
|
||||||
|
|
||||||
|
|
||||||
/* hack.c */
|
/* hack.c */
|
||||||
anything tmp_anything;
|
anything tmp_anything;
|
||||||
|
|||||||
+1
-2
@@ -6,7 +6,6 @@
|
|||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "lev.h"
|
#include "lev.h"
|
||||||
|
|
||||||
extern char bones[]; /* from files.c */
|
|
||||||
#ifdef MFLOPPY
|
#ifdef MFLOPPY
|
||||||
extern long bytes_counted;
|
extern long bytes_counted;
|
||||||
#endif
|
#endif
|
||||||
@@ -573,7 +572,7 @@ getbones()
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (validate(fd, bones) != 0) {
|
if (validate(fd, g.bones) != 0) {
|
||||||
if (!wizard)
|
if (!wizard)
|
||||||
pline("Discarding unuseable bones; no need to panic...");
|
pline("Discarding unuseable bones; no need to panic...");
|
||||||
ok = FALSE;
|
ok = FALSE;
|
||||||
|
|||||||
+10
@@ -368,6 +368,16 @@ const struct instance_globals g_init = {
|
|||||||
FALSE, /* chosen_symset_start */
|
FALSE, /* chosen_symset_start */
|
||||||
FALSE, /* chosen_symset_end */
|
FALSE, /* chosen_symset_end */
|
||||||
0, /* symset_which_set */
|
0, /* symset_which_set */
|
||||||
|
#ifdef HOLD_LOCKFILE_OPEN
|
||||||
|
DUMMY, /* lftrack */
|
||||||
|
#endif
|
||||||
|
DUMMY, /* SAVEF */
|
||||||
|
#ifdef MICRO
|
||||||
|
DUMMY, /* SAVEP */
|
||||||
|
#endif
|
||||||
|
BONESINIT, /* bones */
|
||||||
|
LOCKNAMEINIT, /* lock */
|
||||||
|
|
||||||
|
|
||||||
/* hack.c */
|
/* hack.c */
|
||||||
UNDEFINED_VALUES,
|
UNDEFINED_VALUES,
|
||||||
|
|||||||
+86
-129
@@ -67,38 +67,6 @@ const
|
|||||||
static char fqn_filename_buffer[FQN_NUMBUF][FQN_MAX_FILENAME];
|
static char fqn_filename_buffer[FQN_NUMBUF][FQN_MAX_FILENAME];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MFLOPPY) && !defined(VMS) && !defined(WIN32)
|
|
||||||
char bones[] = "bonesnn.xxx";
|
|
||||||
char lock[PL_NSIZ + 14] = "1lock"; /* long enough for uid+name+.99 */
|
|
||||||
#else
|
|
||||||
#if defined(MFLOPPY)
|
|
||||||
char bones[FILENAME]; /* pathname of bones files */
|
|
||||||
char lock[FILENAME]; /* pathname of level files */
|
|
||||||
#endif
|
|
||||||
#if defined(VMS)
|
|
||||||
char bones[] = "bonesnn.xxx;1";
|
|
||||||
char lock[PL_NSIZ + 17] = "1lock"; /* long enough for _uid+name+.99;1 */
|
|
||||||
#endif
|
|
||||||
#if defined(WIN32)
|
|
||||||
char bones[] = "bonesnn.xxx";
|
|
||||||
char lock[PL_NSIZ + 25]; /* long enough for username+-+name+.99 */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(UNIX) || defined(__BEOS__)
|
|
||||||
#define SAVESIZE (PL_NSIZ + 13) /* save/99999player.e */
|
|
||||||
#else
|
|
||||||
#ifdef VMS
|
|
||||||
#define SAVESIZE (PL_NSIZ + 22) /* [.save]<uid>player.e;1 */
|
|
||||||
#else
|
|
||||||
#if defined(WIN32)
|
|
||||||
#define SAVESIZE (PL_NSIZ + 40) /* username-player.NetHack-saved-game */
|
|
||||||
#else
|
|
||||||
#define SAVESIZE FILENAME /* from macconf.h or pcconf.h */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(SAVE_EXTENSION)
|
#if !defined(SAVE_EXTENSION)
|
||||||
#ifdef MICRO
|
#ifdef MICRO
|
||||||
#define SAVE_EXTENSION ".sav"
|
#define SAVE_EXTENSION ".sav"
|
||||||
@@ -108,18 +76,7 @@ char lock[PL_NSIZ + 25]; /* long enough for username+-+name+.99 */
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char SAVEF[SAVESIZE]; /* holds relative path of save file from playground */
|
|
||||||
#ifdef MICRO
|
|
||||||
char SAVEP[SAVESIZE]; /* holds path of directory for save file */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HOLD_LOCKFILE_OPEN
|
#ifdef HOLD_LOCKFILE_OPEN
|
||||||
struct level_ftrack {
|
|
||||||
int init;
|
|
||||||
int fd; /* file descriptor for level file */
|
|
||||||
int oflag; /* open flags */
|
|
||||||
boolean nethack_thinks_it_is_open; /* Does NetHack think it's open? */
|
|
||||||
} lftrack;
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
#include <share.h>
|
#include <share.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -435,18 +392,18 @@ set_lock_and_bones()
|
|||||||
{
|
{
|
||||||
if (!g.ramdisk) {
|
if (!g.ramdisk) {
|
||||||
Strcpy(levels, g.permbones);
|
Strcpy(levels, g.permbones);
|
||||||
Strcpy(bones, g.permbones);
|
Strcpy(g.bones, g.permbones);
|
||||||
}
|
}
|
||||||
append_slash(g.permbones);
|
append_slash(g.permbones);
|
||||||
append_slash(g.levels);
|
append_slash(g.levels);
|
||||||
#ifdef AMIGA
|
#ifdef AMIGA
|
||||||
strncat(levels, bbs_id, PATHLEN);
|
strncat(levels, bbs_id, PATHLEN);
|
||||||
#endif
|
#endif
|
||||||
append_slash(bones);
|
append_slash(g.bones);
|
||||||
Strcat(bones, "bonesnn.*");
|
Strcat(g.bones, "bonesnn.*");
|
||||||
Strcpy(lock, g.levels);
|
Strcpy(g.lock, g.levels);
|
||||||
#ifndef AMIGA
|
#ifndef AMIGA
|
||||||
Strcat(lock, g.alllevels);
|
Strcat(g.lock, g.alllevels);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -485,8 +442,8 @@ char errbuf[];
|
|||||||
|
|
||||||
if (errbuf)
|
if (errbuf)
|
||||||
*errbuf = '\0';
|
*errbuf = '\0';
|
||||||
set_levelfile_name(lock, lev);
|
set_levelfile_name(g.lock, lev);
|
||||||
fq_lock = fqname(lock, LEVELPREFIX, 0);
|
fq_lock = fqname(g.lock, LEVELPREFIX, 0);
|
||||||
|
|
||||||
#if defined(MICRO) || defined(WIN32)
|
#if defined(MICRO) || defined(WIN32)
|
||||||
/* Use O_TRUNC to force the file to be shortened if it already
|
/* Use O_TRUNC to force the file to be shortened if it already
|
||||||
@@ -511,7 +468,7 @@ char errbuf[];
|
|||||||
g.level_info[lev].flags |= LFILE_EXISTS;
|
g.level_info[lev].flags |= LFILE_EXISTS;
|
||||||
else if (errbuf) /* failure explanation */
|
else if (errbuf) /* failure explanation */
|
||||||
Sprintf(errbuf, "Cannot create file \"%s\" for level %d (errno %d).",
|
Sprintf(errbuf, "Cannot create file \"%s\" for level %d (errno %d).",
|
||||||
lock, lev, errno);
|
g.lock, lev, errno);
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
@@ -526,8 +483,8 @@ char errbuf[];
|
|||||||
|
|
||||||
if (errbuf)
|
if (errbuf)
|
||||||
*errbuf = '\0';
|
*errbuf = '\0';
|
||||||
set_levelfile_name(lock, lev);
|
set_levelfile_name(g.lock, lev);
|
||||||
fq_lock = fqname(lock, LEVELPREFIX, 0);
|
fq_lock = fqname(g.lock, LEVELPREFIX, 0);
|
||||||
#ifdef MFLOPPY
|
#ifdef MFLOPPY
|
||||||
/* If not currently accessible, swap it in. */
|
/* If not currently accessible, swap it in. */
|
||||||
if (g.level_info[lev].where != ACTIVE)
|
if (g.level_info[lev].where != ACTIVE)
|
||||||
@@ -549,7 +506,7 @@ char errbuf[];
|
|||||||
might end up being too big for nethack's BUFSZ */
|
might end up being too big for nethack's BUFSZ */
|
||||||
if (fd < 0 && errbuf)
|
if (fd < 0 && errbuf)
|
||||||
Sprintf(errbuf, "Cannot open file \"%s\" for level %d (errno %d).",
|
Sprintf(errbuf, "Cannot open file \"%s\" for level %d (errno %d).",
|
||||||
lock, lev, errno);
|
g.lock, lev, errno);
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
@@ -563,12 +520,12 @@ int lev;
|
|||||||
* call create_levfile(), so always assume that it exists.
|
* call create_levfile(), so always assume that it exists.
|
||||||
*/
|
*/
|
||||||
if (lev == 0 || (g.level_info[lev].flags & LFILE_EXISTS)) {
|
if (lev == 0 || (g.level_info[lev].flags & LFILE_EXISTS)) {
|
||||||
set_levelfile_name(lock, lev);
|
set_levelfile_name(g.lock, lev);
|
||||||
#ifdef HOLD_LOCKFILE_OPEN
|
#ifdef HOLD_LOCKFILE_OPEN
|
||||||
if (lev == 0)
|
if (lev == 0)
|
||||||
really_close();
|
really_close();
|
||||||
#endif
|
#endif
|
||||||
(void) unlink(fqname(lock, LEVELPREFIX, 0));
|
(void) unlink(fqname(g.lock, LEVELPREFIX, 0));
|
||||||
g.level_info[lev].flags &= ~LFILE_EXISTS;
|
g.level_info[lev].flags &= ~LFILE_EXISTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -624,31 +581,31 @@ int lev, oflag;
|
|||||||
{
|
{
|
||||||
int reslt, fd;
|
int reslt, fd;
|
||||||
|
|
||||||
if (!lftrack.init) {
|
if (!g.lftrack.init) {
|
||||||
lftrack.init = 1;
|
g.lftrack.init = 1;
|
||||||
lftrack.fd = -1;
|
g.lftrack.fd = -1;
|
||||||
}
|
}
|
||||||
if (lftrack.fd >= 0) {
|
if (g.lftrack.fd >= 0) {
|
||||||
/* check for compatible access */
|
/* check for compatible access */
|
||||||
if (lftrack.oflag == oflag) {
|
if (g.lftrack.oflag == oflag) {
|
||||||
fd = lftrack.fd;
|
fd = g.lftrack.fd;
|
||||||
reslt = lseek(fd, 0L, SEEK_SET);
|
reslt = lseek(fd, 0L, SEEK_SET);
|
||||||
if (reslt == -1L)
|
if (reslt == -1L)
|
||||||
panic("open_levelfile_exclusively: lseek failed %d", errno);
|
panic("open_levelfile_exclusively: lseek failed %d", errno);
|
||||||
lftrack.nethack_thinks_it_is_open = TRUE;
|
g.lftrack.nethack_thinks_it_is_open = TRUE;
|
||||||
} else {
|
} else {
|
||||||
really_close();
|
really_close();
|
||||||
fd = sopen(name, oflag, SH_DENYRW, FCMASK);
|
fd = sopen(name, oflag, SH_DENYRW, FCMASK);
|
||||||
lftrack.fd = fd;
|
g.lftrack.fd = fd;
|
||||||
lftrack.oflag = oflag;
|
g.lftrack.oflag = oflag;
|
||||||
lftrack.nethack_thinks_it_is_open = TRUE;
|
g.lftrack.nethack_thinks_it_is_open = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fd = sopen(name, oflag, SH_DENYRW, FCMASK);
|
fd = sopen(name, oflag, SH_DENYRW, FCMASK);
|
||||||
lftrack.fd = fd;
|
g.lftrack.fd = fd;
|
||||||
lftrack.oflag = oflag;
|
g.lftrack.oflag = oflag;
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
lftrack.nethack_thinks_it_is_open = TRUE;
|
g.lftrack.nethack_thinks_it_is_open = TRUE;
|
||||||
}
|
}
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
@@ -658,12 +615,12 @@ really_close()
|
|||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (lftrack.init) {
|
if (g.lftrack.init) {
|
||||||
fd = lftrack.fd;
|
fd = g.lftrack.fd;
|
||||||
|
|
||||||
lftrack.nethack_thinks_it_is_open = FALSE;
|
g.lftrack.nethack_thinks_it_is_open = FALSE;
|
||||||
lftrack.fd = -1;
|
g.lftrack.fd = -1;
|
||||||
lftrack.oflag = 0;
|
g.lftrack.oflag = 0;
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
(void) close(fd);
|
(void) close(fd);
|
||||||
}
|
}
|
||||||
@@ -674,10 +631,10 @@ int
|
|||||||
nhclose(fd)
|
nhclose(fd)
|
||||||
int fd;
|
int fd;
|
||||||
{
|
{
|
||||||
if (lftrack.fd == fd) {
|
if (g.lftrack.fd == fd) {
|
||||||
really_close(); /* close it, but reopen it to hold it */
|
really_close(); /* close it, but reopen it to hold it */
|
||||||
fd = open_levelfile(0, (char *) 0);
|
fd = open_levelfile(0, (char *) 0);
|
||||||
lftrack.nethack_thinks_it_is_open = FALSE;
|
g.lftrack.nethack_thinks_it_is_open = FALSE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return close(fd);
|
return close(fd);
|
||||||
@@ -761,14 +718,14 @@ set_bonestemp_name()
|
|||||||
{
|
{
|
||||||
char *tf;
|
char *tf;
|
||||||
|
|
||||||
tf = rindex(lock, '.');
|
tf = rindex(g.lock, '.');
|
||||||
if (!tf)
|
if (!tf)
|
||||||
tf = eos(lock);
|
tf = eos(g.lock);
|
||||||
Sprintf(tf, ".bn");
|
Sprintf(tf, ".bn");
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
Strcat(tf, ";1");
|
Strcat(tf, ";1");
|
||||||
#endif
|
#endif
|
||||||
return lock;
|
return g.lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -782,7 +739,7 @@ char errbuf[];
|
|||||||
|
|
||||||
if (errbuf)
|
if (errbuf)
|
||||||
*errbuf = '\0';
|
*errbuf = '\0';
|
||||||
*bonesid = set_bonesfile_name(bones, lev);
|
*bonesid = set_bonesfile_name(g.bones, lev);
|
||||||
file = set_bonestemp_name();
|
file = set_bonestemp_name();
|
||||||
file = fqname(file, BONESPREFIX, 0);
|
file = fqname(file, BONESPREFIX, 0);
|
||||||
|
|
||||||
@@ -799,7 +756,7 @@ char errbuf[];
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (fd < 0 && errbuf) /* failure explanation */
|
if (fd < 0 && errbuf) /* failure explanation */
|
||||||
Sprintf(errbuf, "Cannot create bones \"%s\", id %s (errno %d).", lock,
|
Sprintf(errbuf, "Cannot create bones \"%s\", id %s (errno %d).", g.lock,
|
||||||
*bonesid, errno);
|
*bonesid, errno);
|
||||||
|
|
||||||
#if defined(VMS) && !defined(SECURE)
|
#if defined(VMS) && !defined(SECURE)
|
||||||
@@ -838,8 +795,8 @@ d_level *lev;
|
|||||||
const char *fq_bones, *tempname;
|
const char *fq_bones, *tempname;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
(void) set_bonesfile_name(bones, lev);
|
(void) set_bonesfile_name(g.bones, lev);
|
||||||
fq_bones = fqname(bones, BONESPREFIX, 0);
|
fq_bones = fqname(g.bones, BONESPREFIX, 0);
|
||||||
tempname = set_bonestemp_name();
|
tempname = set_bonestemp_name();
|
||||||
tempname = fqname(tempname, BONESPREFIX, 1);
|
tempname = fqname(tempname, BONESPREFIX, 1);
|
||||||
|
|
||||||
@@ -865,8 +822,8 @@ char **bonesid;
|
|||||||
const char *fq_bones;
|
const char *fq_bones;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
*bonesid = set_bonesfile_name(bones, lev);
|
*bonesid = set_bonesfile_name(g.bones, lev);
|
||||||
fq_bones = fqname(bones, BONESPREFIX, 0);
|
fq_bones = fqname(g.bones, BONESPREFIX, 0);
|
||||||
nh_uncompress(fq_bones); /* no effect if nonexistent */
|
nh_uncompress(fq_bones); /* no effect if nonexistent */
|
||||||
#ifdef MAC
|
#ifdef MAC
|
||||||
fd = macopen(fq_bones, O_RDONLY | O_BINARY, BONE_TYPE);
|
fd = macopen(fq_bones, O_RDONLY | O_BINARY, BONE_TYPE);
|
||||||
@@ -880,8 +837,8 @@ int
|
|||||||
delete_bonesfile(lev)
|
delete_bonesfile(lev)
|
||||||
d_level *lev;
|
d_level *lev;
|
||||||
{
|
{
|
||||||
(void) set_bonesfile_name(bones, lev);
|
(void) set_bonesfile_name(g.bones, lev);
|
||||||
return !(unlink(fqname(bones, BONESPREFIX, 0)) < 0);
|
return !(unlink(fqname(g.bones, BONESPREFIX, 0)) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* assume we're compressing the recently read or created bonesfile, so the
|
/* assume we're compressing the recently read or created bonesfile, so the
|
||||||
@@ -889,7 +846,7 @@ d_level *lev;
|
|||||||
void
|
void
|
||||||
compress_bonesfile()
|
compress_bonesfile()
|
||||||
{
|
{
|
||||||
nh_compress(fqname(bones, BONESPREFIX, 0));
|
nh_compress(fqname(g.bones, BONESPREFIX, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- END BONES FILE HANDLING ----------- */
|
/* ---------- END BONES FILE HANDLING ----------- */
|
||||||
@@ -903,28 +860,28 @@ set_savefile_name(regularize_it)
|
|||||||
boolean regularize_it;
|
boolean regularize_it;
|
||||||
{
|
{
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
Sprintf(SAVEF, "[.save]%d%s", getuid(), g.plname);
|
Sprintf(g.SAVEF, "[.save]%d%s", getuid(), g.plname);
|
||||||
if (regularize_it)
|
if (regularize_it)
|
||||||
regularize(SAVEF + 7);
|
regularize(g.SAVEF + 7);
|
||||||
Strcat(SAVEF, ";1");
|
Strcat(g.SAVEF, ";1");
|
||||||
#else
|
#else
|
||||||
#if defined(MICRO)
|
#if defined(MICRO)
|
||||||
Strcpy(SAVEF, SAVEP);
|
Strcpy(g.SAVEF, g.SAVEP);
|
||||||
#ifdef AMIGA
|
#ifdef AMIGA
|
||||||
strncat(SAVEF, bbs_id, PATHLEN);
|
strncat(g.SAVEF, bbs_id, PATHLEN);
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int i = strlen(SAVEP);
|
int i = strlen(g.SAVEP);
|
||||||
#ifdef AMIGA
|
#ifdef AMIGA
|
||||||
/* g.plname has to share space with SAVEP and ".sav" */
|
/* g.plname has to share space with g.SAVEP and ".sav" */
|
||||||
(void) strncat(SAVEF, g.plname, FILENAME - i - 4);
|
(void) strncat(g.SAVEF, g.plname, FILENAME - i - 4);
|
||||||
#else
|
#else
|
||||||
(void) strncat(SAVEF, g.plname, 8);
|
(void) strncat(g.SAVEF, g.plname, 8);
|
||||||
#endif
|
#endif
|
||||||
if (regularize_it)
|
if (regularize_it)
|
||||||
regularize(SAVEF + i);
|
regularize(g.SAVEF + i);
|
||||||
}
|
}
|
||||||
Strcat(SAVEF, SAVE_EXTENSION);
|
Strcat(g.SAVEF, SAVE_EXTENSION);
|
||||||
#else
|
#else
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
{
|
{
|
||||||
@@ -939,12 +896,12 @@ boolean regularize_it;
|
|||||||
if (regularize_it)
|
if (regularize_it)
|
||||||
++legal; /* skip '*' wildcard character */
|
++legal; /* skip '*' wildcard character */
|
||||||
(void) fname_encode(legal, '%', fnamebuf, encodedfnamebuf, BUFSZ);
|
(void) fname_encode(legal, '%', fnamebuf, encodedfnamebuf, BUFSZ);
|
||||||
Sprintf(SAVEF, "%s%s", encodedfnamebuf, SAVE_EXTENSION);
|
Sprintf(g.SAVEF, "%s%s", encodedfnamebuf, SAVE_EXTENSION);
|
||||||
}
|
}
|
||||||
#else /* not VMS or MICRO or WIN32 */
|
#else /* not VMS or MICRO or WIN32 */
|
||||||
Sprintf(SAVEF, "save/%d%s", (int) getuid(), g.plname);
|
Sprintf(g.SAVEF, "save/%d%s", (int) getuid(), g.plname);
|
||||||
if (regularize_it)
|
if (regularize_it)
|
||||||
regularize(SAVEF + 5); /* avoid . or / in name */
|
regularize(g.SAVEF + 5); /* avoid . or / in name */
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
#endif /* MICRO */
|
#endif /* MICRO */
|
||||||
#endif /* VMS */
|
#endif /* VMS */
|
||||||
@@ -955,7 +912,7 @@ void
|
|||||||
save_savefile_name(fd)
|
save_savefile_name(fd)
|
||||||
int fd;
|
int fd;
|
||||||
{
|
{
|
||||||
(void) write(fd, (genericptr_t) SAVEF, sizeof(SAVEF));
|
(void) write(fd, (genericptr_t) g.SAVEF, sizeof(g.SAVEF));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -966,17 +923,17 @@ set_error_savefile()
|
|||||||
{
|
{
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
{
|
{
|
||||||
char *semi_colon = rindex(SAVEF, ';');
|
char *semi_colon = rindex(g.SAVEF, ';');
|
||||||
|
|
||||||
if (semi_colon)
|
if (semi_colon)
|
||||||
*semi_colon = '\0';
|
*semi_colon = '\0';
|
||||||
}
|
}
|
||||||
Strcat(SAVEF, ".e;1");
|
Strcat(g.SAVEF, ".e;1");
|
||||||
#else
|
#else
|
||||||
#ifdef MAC
|
#ifdef MAC
|
||||||
Strcat(SAVEF, "-e");
|
Strcat(g.SAVEF, "-e");
|
||||||
#else
|
#else
|
||||||
Strcat(SAVEF, ".e");
|
Strcat(g.SAVEF, ".e");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -989,7 +946,7 @@ create_savefile()
|
|||||||
const char *fq_save;
|
const char *fq_save;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fq_save = fqname(SAVEF, SAVEPREFIX, 0);
|
fq_save = fqname(g.SAVEF, SAVEPREFIX, 0);
|
||||||
#if defined(MICRO) || defined(WIN32)
|
#if defined(MICRO) || defined(WIN32)
|
||||||
fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FCMASK);
|
fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FCMASK);
|
||||||
#else
|
#else
|
||||||
@@ -1020,7 +977,7 @@ open_savefile()
|
|||||||
const char *fq_save;
|
const char *fq_save;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fq_save = fqname(SAVEF, SAVEPREFIX, 0);
|
fq_save = fqname(g.SAVEF, SAVEPREFIX, 0);
|
||||||
#ifdef MAC
|
#ifdef MAC
|
||||||
fd = macopen(fq_save, O_RDONLY | O_BINARY, SAVE_TYPE);
|
fd = macopen(fq_save, O_RDONLY | O_BINARY, SAVE_TYPE);
|
||||||
#else
|
#else
|
||||||
@@ -1033,7 +990,7 @@ open_savefile()
|
|||||||
int
|
int
|
||||||
delete_savefile()
|
delete_savefile()
|
||||||
{
|
{
|
||||||
(void) unlink(fqname(SAVEF, SAVEPREFIX, 0));
|
(void) unlink(fqname(g.SAVEF, SAVEPREFIX, 0));
|
||||||
return 0; /* for restore_saved_game() (ex-xxxmain.c) test */
|
return 0; /* for restore_saved_game() (ex-xxxmain.c) test */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,7 +1007,7 @@ restore_saved_game()
|
|||||||
if (!saveDiskPrompt(1))
|
if (!saveDiskPrompt(1))
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* MFLOPPY */
|
#endif /* MFLOPPY */
|
||||||
fq_save = fqname(SAVEF, SAVEPREFIX, 0);
|
fq_save = fqname(g.SAVEF, SAVEPREFIX, 0);
|
||||||
|
|
||||||
nh_uncompress(fq_save);
|
nh_uncompress(fq_save);
|
||||||
if ((fd = open_savefile()) < 0)
|
if ((fd = open_savefile()) < 0)
|
||||||
@@ -1071,11 +1028,11 @@ const char *filename;
|
|||||||
int fd;
|
int fd;
|
||||||
char *result = 0;
|
char *result = 0;
|
||||||
|
|
||||||
Strcpy(SAVEF, filename);
|
Strcpy(g.SAVEF, filename);
|
||||||
#ifdef COMPRESS_EXTENSION
|
#ifdef COMPRESS_EXTENSION
|
||||||
SAVEF[strlen(SAVEF) - strlen(COMPRESS_EXTENSION)] = '\0';
|
g.SAVEF[strlen(g.SAVEF) - strlen(COMPRESS_EXTENSION)] = '\0';
|
||||||
#endif
|
#endif
|
||||||
nh_uncompress(SAVEF);
|
nh_uncompress(g.SAVEF);
|
||||||
if ((fd = open_savefile()) >= 0) {
|
if ((fd = open_savefile()) >= 0) {
|
||||||
if (validate(fd, filename) == 0) {
|
if (validate(fd, filename) == 0) {
|
||||||
char tplname[PL_NSIZ];
|
char tplname[PL_NSIZ];
|
||||||
@@ -1084,7 +1041,7 @@ const char *filename;
|
|||||||
}
|
}
|
||||||
(void) nhclose(fd);
|
(void) nhclose(fd);
|
||||||
}
|
}
|
||||||
nh_compress(SAVEF);
|
nh_compress(g.SAVEF);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#if 0
|
#if 0
|
||||||
@@ -1133,9 +1090,9 @@ get_saved_games()
|
|||||||
Strcpy(g.plname, "*");
|
Strcpy(g.plname, "*");
|
||||||
set_savefile_name(FALSE);
|
set_savefile_name(FALSE);
|
||||||
#if defined(ZLIB_COMP)
|
#if defined(ZLIB_COMP)
|
||||||
Strcat(SAVEF, COMPRESS_EXTENSION);
|
Strcat(g.SAVEF, COMPRESS_EXTENSION);
|
||||||
#endif
|
#endif
|
||||||
fq_save = fqname(SAVEF, SAVEPREFIX, 0);
|
fq_save = fqname(g.SAVEF, SAVEPREFIX, 0);
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
foundfile = foundfile_buffer();
|
foundfile = foundfile_buffer();
|
||||||
@@ -1202,7 +1159,7 @@ get_saved_games()
|
|||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
Strcpy(g.plname, "*");
|
Strcpy(g.plname, "*");
|
||||||
set_savefile_name(FALSE);
|
set_savefile_name(FALSE);
|
||||||
j = vms_get_saved_games(SAVEF, &result);
|
j = vms_get_saved_games(g.SAVEF, &result);
|
||||||
#endif /* VMS */
|
#endif /* VMS */
|
||||||
|
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
@@ -2350,8 +2307,8 @@ char *origbuf;
|
|||||||
g.saveprompt = sysflags.asksavedisk;
|
g.saveprompt = sysflags.asksavedisk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void) strncpy(SAVEP, bufp, SAVESIZE - 1);
|
(void) strncpy(g.SAVEP, bufp, SAVESIZE - 1);
|
||||||
append_slash(SAVEP);
|
append_slash(g.SAVEP);
|
||||||
#endif /* MICRO */
|
#endif /* MICRO */
|
||||||
#endif /*NOCWD_ASSUMPTIONS*/
|
#endif /*NOCWD_ASSUMPTIONS*/
|
||||||
|
|
||||||
@@ -3622,7 +3579,7 @@ recover_savefile()
|
|||||||
!= sizeof(savelev)) {
|
!= sizeof(savelev)) {
|
||||||
raw_printf(
|
raw_printf(
|
||||||
"\nCheckpointing was not in effect for %s -- recovery impossible.\n",
|
"\nCheckpointing was not in effect for %s -- recovery impossible.\n",
|
||||||
lock);
|
g.lock);
|
||||||
(void) nhclose(gfd);
|
(void) nhclose(gfd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -3634,7 +3591,7 @@ recover_savefile()
|
|||||||
|| (read(gfd, (genericptr_t) &pltmpsiz, sizeof pltmpsiz)
|
|| (read(gfd, (genericptr_t) &pltmpsiz, sizeof pltmpsiz)
|
||||||
!= sizeof pltmpsiz) || (pltmpsiz > PL_NSIZ)
|
!= sizeof pltmpsiz) || (pltmpsiz > PL_NSIZ)
|
||||||
|| (read(gfd, (genericptr_t) &tmpplbuf, pltmpsiz) != pltmpsiz)) {
|
|| (read(gfd, (genericptr_t) &tmpplbuf, pltmpsiz) != pltmpsiz)) {
|
||||||
raw_printf("\nError reading %s -- can't recover.\n", lock);
|
raw_printf("\nError reading %s -- can't recover.\n", g.lock);
|
||||||
(void) nhclose(gfd);
|
(void) nhclose(gfd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -3650,7 +3607,7 @@ recover_savefile()
|
|||||||
set_savefile_name(TRUE);
|
set_savefile_name(TRUE);
|
||||||
sfd = create_savefile();
|
sfd = create_savefile();
|
||||||
if (sfd < 0) {
|
if (sfd < 0) {
|
||||||
raw_printf("\nCannot recover savefile %s.\n", SAVEF);
|
raw_printf("\nCannot recover savefile %s.\n", g.SAVEF);
|
||||||
(void) nhclose(gfd);
|
(void) nhclose(gfd);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -3666,7 +3623,7 @@ recover_savefile()
|
|||||||
|
|
||||||
if (write(sfd, (genericptr_t) &version_data, sizeof version_data)
|
if (write(sfd, (genericptr_t) &version_data, sizeof version_data)
|
||||||
!= sizeof version_data) {
|
!= sizeof version_data) {
|
||||||
raw_printf("\nError writing %s; recovery failed.", SAVEF);
|
raw_printf("\nError writing %s; recovery failed.", g.SAVEF);
|
||||||
(void) nhclose(gfd);
|
(void) nhclose(gfd);
|
||||||
(void) nhclose(sfd);
|
(void) nhclose(sfd);
|
||||||
(void) nhclose(lfd);
|
(void) nhclose(lfd);
|
||||||
@@ -3676,7 +3633,7 @@ recover_savefile()
|
|||||||
|
|
||||||
if (write(sfd, (genericptr_t) &sfi, sizeof sfi) != sizeof sfi) {
|
if (write(sfd, (genericptr_t) &sfi, sizeof sfi) != sizeof sfi) {
|
||||||
raw_printf("\nError writing %s; recovery failed (savefile_info).\n",
|
raw_printf("\nError writing %s; recovery failed (savefile_info).\n",
|
||||||
SAVEF);
|
g.SAVEF);
|
||||||
(void) nhclose(gfd);
|
(void) nhclose(gfd);
|
||||||
(void) nhclose(sfd);
|
(void) nhclose(sfd);
|
||||||
(void) nhclose(lfd);
|
(void) nhclose(lfd);
|
||||||
@@ -3687,7 +3644,7 @@ recover_savefile()
|
|||||||
if (write(sfd, (genericptr_t) &pltmpsiz, sizeof pltmpsiz)
|
if (write(sfd, (genericptr_t) &pltmpsiz, sizeof pltmpsiz)
|
||||||
!= sizeof pltmpsiz) {
|
!= sizeof pltmpsiz) {
|
||||||
raw_printf("Error writing %s; recovery failed (player name size).\n",
|
raw_printf("Error writing %s; recovery failed (player name size).\n",
|
||||||
SAVEF);
|
g.SAVEF);
|
||||||
(void) nhclose(gfd);
|
(void) nhclose(gfd);
|
||||||
(void) nhclose(sfd);
|
(void) nhclose(sfd);
|
||||||
(void) nhclose(lfd);
|
(void) nhclose(lfd);
|
||||||
@@ -3697,7 +3654,7 @@ recover_savefile()
|
|||||||
|
|
||||||
if (write(sfd, (genericptr_t) &tmpplbuf, pltmpsiz) != pltmpsiz) {
|
if (write(sfd, (genericptr_t) &tmpplbuf, pltmpsiz) != pltmpsiz) {
|
||||||
raw_printf("Error writing %s; recovery failed (player name).\n",
|
raw_printf("Error writing %s; recovery failed (player name).\n",
|
||||||
SAVEF);
|
g.SAVEF);
|
||||||
(void) nhclose(gfd);
|
(void) nhclose(gfd);
|
||||||
(void) nhclose(sfd);
|
(void) nhclose(sfd);
|
||||||
(void) nhclose(lfd);
|
(void) nhclose(lfd);
|
||||||
@@ -3758,8 +3715,8 @@ recover_savefile()
|
|||||||
if (processed[lev]) {
|
if (processed[lev]) {
|
||||||
const char *fq_lock;
|
const char *fq_lock;
|
||||||
|
|
||||||
set_levelfile_name(lock, lev);
|
set_levelfile_name(g.lock, lev);
|
||||||
fq_lock = fqname(lock, LEVELPREFIX, 3);
|
fq_lock = fqname(g.lock, LEVELPREFIX, 3);
|
||||||
(void) unlink(fq_lock);
|
(void) unlink(fq_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -120,9 +120,9 @@ dosave0()
|
|||||||
if (iflags.save_uburied)
|
if (iflags.save_uburied)
|
||||||
u.uburied = 1, iflags.save_uburied = 0;
|
u.uburied = 1, iflags.save_uburied = 0;
|
||||||
|
|
||||||
if (!g.program_state.something_worth_saving || !SAVEF[0])
|
if (!g.program_state.something_worth_saving || !g.SAVEF[0])
|
||||||
return 0;
|
return 0;
|
||||||
fq_save = fqname(SAVEF, SAVEPREFIX, 1); /* level files take 0 */
|
fq_save = fqname(g.SAVEF, SAVEPREFIX, 1); /* level files take 0 */
|
||||||
|
|
||||||
#if defined(UNIX) || defined(VMS)
|
#if defined(UNIX) || defined(VMS)
|
||||||
sethanguphandler((void FDECL((*), (int) )) SIG_IGN);
|
sethanguphandler((void FDECL((*), (int) )) SIG_IGN);
|
||||||
|
|||||||
+5
-5
@@ -279,7 +279,7 @@ saveDiskPrompt(start)
|
|||||||
BPTR fileLock;
|
BPTR fileLock;
|
||||||
if (sysflags.asksavedisk) {
|
if (sysflags.asksavedisk) {
|
||||||
/* Don't prompt if you can find the save file */
|
/* Don't prompt if you can find the save file */
|
||||||
if (fileLock = Lock(SAVEF, SHARED_LOCK)) {
|
if (fileLock = Lock(g.SAVEF, SHARED_LOCK)) {
|
||||||
UnLock(fileLock);
|
UnLock(fileLock);
|
||||||
#if defined(TTY_GRAPHICS)
|
#if defined(TTY_GRAPHICS)
|
||||||
if (windowprocs.win_init_nhwindows
|
if (windowprocs.win_init_nhwindows
|
||||||
@@ -294,7 +294,7 @@ saveDiskPrompt(start)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
pline("If save file is on a SAVE disk, put that disk in now.");
|
pline("If save file is on a SAVE disk, put that disk in now.");
|
||||||
if (strlen(SAVEF) > QBUFSZ - 25 - 22)
|
if (strlen(g.SAVEF) > QBUFSZ - 25 - 22)
|
||||||
panic("not enough buffer space for prompt");
|
panic("not enough buffer space for prompt");
|
||||||
/* THIS IS A HACK */
|
/* THIS IS A HACK */
|
||||||
#if defined(TTY_GRAPHICS)
|
#if defined(TTY_GRAPHICS)
|
||||||
@@ -305,7 +305,7 @@ saveDiskPrompt(start)
|
|||||||
#endif
|
#endif
|
||||||
#if defined(AMII_GRAPHICS)
|
#if defined(AMII_GRAPHICS)
|
||||||
if (windowprocs.win_init_nhwindows == amii_procs.win_init_nhwindows) {
|
if (windowprocs.win_init_nhwindows == amii_procs.win_init_nhwindows) {
|
||||||
getlind("File name ?", buf, SAVEF);
|
getlind("File name ?", buf, g.SAVEF);
|
||||||
clear_nhwindow(WIN_BASE);
|
clear_nhwindow(WIN_BASE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -314,11 +314,11 @@ saveDiskPrompt(start)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Strip any whitespace. Also, if nothing was entered except
|
/* Strip any whitespace. Also, if nothing was entered except
|
||||||
* whitespace, do not change the value of SAVEF.
|
* whitespace, do not change the value of g.SAVEF.
|
||||||
*/
|
*/
|
||||||
for (bp = buf; *bp; bp++) {
|
for (bp = buf; *bp; bp++) {
|
||||||
if (!isspace(*bp)) {
|
if (!isspace(*bp)) {
|
||||||
strncpy(SAVEF, bp, PATHLEN);
|
strncpy(g.SAVEF, bp, PATHLEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -88,7 +88,7 @@ attempt_restore:
|
|||||||
if (yn("Do you want to keep the save file?") == 'n')
|
if (yn("Do you want to keep the save file?") == 'n')
|
||||||
(void) delete_savefile();
|
(void) delete_savefile();
|
||||||
else {
|
else {
|
||||||
nh_compress(fqname(SAVEF, SAVEPREFIX, 0));
|
nh_compress(fqname(g.SAVEF, SAVEPREFIX, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -102,7 +102,7 @@ attempt_restore:
|
|||||||
if (yn("Do you want to keep the save file?") == 'n')
|
if (yn("Do you want to keep the save file?") == 'n')
|
||||||
(void) delete_savefile();
|
(void) delete_savefile();
|
||||||
else {
|
else {
|
||||||
nh_compress(fqname(SAVEF, SAVEPREFIX, 0));
|
nh_compress(fqname(g.SAVEF, SAVEPREFIX, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ process_openfile(short src_vol, long src_dir, Str255 fName, OSType ftype)
|
|||||||
Str255 save_f_p;
|
Str255 save_f_p;
|
||||||
P2C(*(StringHandle) name, g.plname);
|
P2C(*(StringHandle) name, g.plname);
|
||||||
set_savefile_name(TRUE);
|
set_savefile_name(TRUE);
|
||||||
C2P(fqname(SAVEF, SAVEPREFIX, 0), save_f_p);
|
C2P(fqname(g.SAVEF, SAVEPREFIX, 0), save_f_p);
|
||||||
force_hdelete(theDirs.dataRefNum, theDirs.dataDirID,
|
force_hdelete(theDirs.dataRefNum, theDirs.dataDirID,
|
||||||
save_f_p);
|
save_f_p);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -489,7 +489,7 @@ attempt_restore:
|
|||||||
if (yn("Do you want to keep the save file?") == 'n')
|
if (yn("Do you want to keep the save file?") == 'n')
|
||||||
(void) delete_savefile();
|
(void) delete_savefile();
|
||||||
else {
|
else {
|
||||||
nh_compress(fqname(SAVEF, SAVEPREFIX, 0));
|
nh_compress(fqname(g.SAVEF, SAVEPREFIX, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -285,7 +285,7 @@ int start;
|
|||||||
clear_nhwindow(WIN_MESSAGE);
|
clear_nhwindow(WIN_MESSAGE);
|
||||||
pline("If save file is on a save disk, insert that disk now.");
|
pline("If save file is on a save disk, insert that disk now.");
|
||||||
mark_synch();
|
mark_synch();
|
||||||
Sprintf(qbuf, "File name (default \"%s\"%s) ?", SAVEF,
|
Sprintf(qbuf, "File name (default \"%s\"%s) ?", g.SAVEF,
|
||||||
start ? "" : ", <Esc> cancels save");
|
start ? "" : ", <Esc> cancels save");
|
||||||
getlin(qbuf, buf);
|
getlin(qbuf, buf);
|
||||||
clear_nhwindow(WIN_MESSAGE);
|
clear_nhwindow(WIN_MESSAGE);
|
||||||
@@ -293,11 +293,11 @@ int start;
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Strip any whitespace. Also, if nothing was entered except
|
/* Strip any whitespace. Also, if nothing was entered except
|
||||||
* whitespace, do not change the value of SAVEF.
|
* whitespace, do not change the value of g.SAVEF.
|
||||||
*/
|
*/
|
||||||
for (bp = buf; *bp; bp++)
|
for (bp = buf; *bp; bp++)
|
||||||
if (!isspace((uchar) *bp)) {
|
if (!isspace((uchar) *bp)) {
|
||||||
strncpy(SAVEF, bp, PATHLEN);
|
strncpy(g.SAVEF, bp, PATHLEN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -281,7 +281,7 @@ attempt_restore:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*g.plname && (fd = restore_saved_game()) >= 0) {
|
if (*g.plname && (fd = restore_saved_game()) >= 0) {
|
||||||
const char *fq_save = fqname(SAVEF, SAVEPREFIX, 1);
|
const char *fq_save = fqname(g.SAVEF, SAVEPREFIX, 1);
|
||||||
|
|
||||||
(void) chmod(fq_save, 0); /* disallow parallel restores */
|
(void) chmod(fq_save, 0); /* disallow parallel restores */
|
||||||
#ifndef NO_SIGNAL
|
#ifndef NO_SIGNAL
|
||||||
|
|||||||
+1
-1
@@ -176,7 +176,7 @@ char *argv[];
|
|||||||
*/
|
*/
|
||||||
attempt_restore:
|
attempt_restore:
|
||||||
if ((fd = restore_saved_game()) >= 0) {
|
if ((fd = restore_saved_game()) >= 0) {
|
||||||
const char *fq_save = fqname(SAVEF, SAVEPREFIX, 1);
|
const char *fq_save = fqname(g.SAVEF, SAVEPREFIX, 1);
|
||||||
|
|
||||||
(void) chmod(fq_save, 0); /* disallow parallel restores */
|
(void) chmod(fq_save, 0); /* disallow parallel restores */
|
||||||
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
|
(void) signal(SIGINT, (SIG_RET_TYPE) done1);
|
||||||
|
|||||||
+1
-1
@@ -564,7 +564,7 @@ char ***outarray;
|
|||||||
char *charname, wildcard[255 + 1], filename[255 + 1];
|
char *charname, wildcard[255 + 1], filename[255 + 1];
|
||||||
genericptr_t context = 0;
|
genericptr_t context = 0;
|
||||||
|
|
||||||
Strcpy(wildcard, savetemplate); /* plname_from_file overwrites SAVEF */
|
Strcpy(wildcard, savetemplate); /* plname_from_file overwrites g.SAVEF */
|
||||||
in.mbz = 0; /* class and type; leave them unspecified */
|
in.mbz = 0; /* class and type; leave them unspecified */
|
||||||
in.len = (unsigned short) strlen(wildcard);
|
in.len = (unsigned short) strlen(wildcard);
|
||||||
in.adr = wildcard;
|
in.adr = wildcard;
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
(void) fname_encode(
|
(void) fname_encode(
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.", '%',
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.", '%',
|
||||||
fnamebuf, encodedfnamebuf, BUFSZ);
|
fnamebuf, encodedfnamebuf, BUFSZ);
|
||||||
Sprintf(lock, "%s", encodedfnamebuf);
|
Sprintf(g.lock, "%s", encodedfnamebuf);
|
||||||
/* regularize(lock); */ /* we encode now, rather than substitute */
|
/* regularize(lock); */ /* we encode now, rather than substitute */
|
||||||
getlock();
|
getlock();
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ attempt_restore:
|
|||||||
if (yn("Do you want to keep the save file?") == 'n')
|
if (yn("Do you want to keep the save file?") == 'n')
|
||||||
(void) delete_savefile();
|
(void) delete_savefile();
|
||||||
else {
|
else {
|
||||||
nh_compress(fqname(SAVEF, SAVEPREFIX, 0));
|
nh_compress(fqname(g.SAVEF, SAVEPREFIX, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -755,14 +755,14 @@ eraseoldlocks()
|
|||||||
*/
|
*/
|
||||||
for (i = 1; i <= MAXDUNGEON * MAXLEVEL + 1; i++) {
|
for (i = 1; i <= MAXDUNGEON * MAXLEVEL + 1; i++) {
|
||||||
/* try to remove all */
|
/* try to remove all */
|
||||||
set_levelfile_name(lock, i);
|
set_levelfile_name(g.lock, i);
|
||||||
(void) unlink(fqname(lock, LEVELPREFIX, 0));
|
(void) unlink(fqname(g.lock, LEVELPREFIX, 0));
|
||||||
}
|
}
|
||||||
set_levelfile_name(lock, 0);
|
set_levelfile_name(g.lock, 0);
|
||||||
#ifdef HOLD_LOCKFILE_OPEN
|
#ifdef HOLD_LOCKFILE_OPEN
|
||||||
really_close();
|
really_close();
|
||||||
#endif
|
#endif
|
||||||
if (unlink(fqname(lock, LEVELPREFIX, 0)))
|
if (unlink(fqname(g.lock, LEVELPREFIX, 0)))
|
||||||
return 0; /* cannot remove it */
|
return 0; /* cannot remove it */
|
||||||
return (1); /* success! */
|
return (1); /* success! */
|
||||||
}
|
}
|
||||||
@@ -787,9 +787,9 @@ getlock()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* regularize(lock); */ /* already done in pcmain */
|
/* regularize(lock); */ /* already done in pcmain */
|
||||||
Sprintf(tbuf, "%s", fqname(lock, LEVELPREFIX, 0));
|
Sprintf(tbuf, "%s", fqname(g.lock, LEVELPREFIX, 0));
|
||||||
set_levelfile_name(lock, 0);
|
set_levelfile_name(g.lock, 0);
|
||||||
fq_lock = fqname(lock, LEVELPREFIX, 1);
|
fq_lock = fqname(g.lock, LEVELPREFIX, 1);
|
||||||
if ((fd = open(fq_lock, 0)) == -1) {
|
if ((fd = open(fq_lock, 0)) == -1) {
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
goto gotlock; /* no such file */
|
goto gotlock; /* no such file */
|
||||||
|
|||||||
@@ -1614,11 +1614,6 @@ const char *s2;
|
|||||||
struct attribs attrmax, attrmin;
|
struct attribs attrmax, attrmin;
|
||||||
/* files.c */
|
/* files.c */
|
||||||
const char *configfile;
|
const char *configfile;
|
||||||
char lock[ARBITRARY_SIZE];
|
|
||||||
char SAVEF[ARBITRARY_SIZE];
|
|
||||||
#ifdef MICRO
|
|
||||||
char SAVEP[ARBITRARY_SIZE];
|
|
||||||
#endif
|
|
||||||
/* termcap.c */
|
/* termcap.c */
|
||||||
struct tc_lcl_data tc_lcl_data;
|
struct tc_lcl_data tc_lcl_data;
|
||||||
#ifdef TEXTCOLOR
|
#ifdef TEXTCOLOR
|
||||||
|
|||||||
Reference in New Issue
Block a user