globals from files.c moved to instance globals.
This commit is contained in:
@@ -301,7 +301,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
||||
(void) fname_encode(
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-.", '%',
|
||||
fnamebuf, encodedfnamebuf, BUFSZ);
|
||||
Sprintf(lock, "%s", encodedfnamebuf);
|
||||
Sprintf(g.lock, "%s", encodedfnamebuf);
|
||||
/* regularize(lock); */ /* we encode now, rather than substitute */
|
||||
getlock();
|
||||
|
||||
@@ -343,7 +343,7 @@ attempt_restore:
|
||||
if (yn("Do you want to keep the save file?") == 'n')
|
||||
(void) delete_savefile();
|
||||
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++) {
|
||||
/* try to remove all */
|
||||
set_levelfile_name(lock, i);
|
||||
(void) unlink(fqname(lock, LEVELPREFIX, 0));
|
||||
set_levelfile_name(g.lock, i);
|
||||
(void) unlink(fqname(g.lock, LEVELPREFIX, 0));
|
||||
}
|
||||
set_levelfile_name(lock, 0);
|
||||
set_levelfile_name(g.lock, 0);
|
||||
#ifdef HOLD_LOCKFILE_OPEN
|
||||
really_close();
|
||||
#endif
|
||||
if (unlink(fqname(lock, LEVELPREFIX, 0)))
|
||||
if (unlink(fqname(g.lock, LEVELPREFIX, 0)))
|
||||
return 0; /* cannot remove it */
|
||||
return (1); /* success! */
|
||||
}
|
||||
@@ -787,9 +787,9 @@ getlock()
|
||||
}
|
||||
|
||||
/* regularize(lock); */ /* already done in pcmain */
|
||||
Sprintf(tbuf, "%s", fqname(lock, LEVELPREFIX, 0));
|
||||
set_levelfile_name(lock, 0);
|
||||
fq_lock = fqname(lock, LEVELPREFIX, 1);
|
||||
Sprintf(tbuf, "%s", fqname(g.lock, LEVELPREFIX, 0));
|
||||
set_levelfile_name(g.lock, 0);
|
||||
fq_lock = fqname(g.lock, LEVELPREFIX, 1);
|
||||
if ((fd = open(fq_lock, 0)) == -1) {
|
||||
if (errno == ENOENT)
|
||||
goto gotlock; /* no such file */
|
||||
|
||||
Reference in New Issue
Block a user