UNIX, VMS, DEF_PAGER, MICRO and MFLOPPY globals moved to g.

This commit is contained in:
Bart House
2018-12-25 09:34:24 -08:00
parent 0763046c38
commit 16db7498d0
14 changed files with 108 additions and 109 deletions

View File

@@ -211,7 +211,7 @@ const char *path, *files;
struct FileInfoBlock *fibp;
int chklen;
#ifdef BETA
if(files != alllevels)panic("eraseall");
if(files != g.alllevels)panic("eraseall");
#endif
chklen=(int)index(files,'*')-(int)files;

View File

@@ -628,7 +628,7 @@ char *argv[];
/* Player doesn't want to use a RAM disk
*/
case 'R':
ramdisk = FALSE;
g.ramdisk = FALSE;
break;
#endif
#endif

View File

@@ -167,18 +167,18 @@ int mode;
char copy[8], *comspec;
#endif
if (!ramdisk)
if (!g.ramdisk)
return;
/* Find the name of the last file to be transferred
*/
frompath = (mode != TOPERM) ? permbones : levels;
frompath = (mode != TOPERM) ? g.permbones : g.levels;
foundfile = foundfile_buffer();
last[0] = '\0';
Sprintf(from, "%s%s", frompath, allbones);
topath = (mode == TOPERM) ? permbones : levels;
Sprintf(from, "%s%s", frompath, g.allbones);
topath = (mode == TOPERM) ? g.permbones : g.levels;
#ifdef TOS
eraseall(topath, allbones);
eraseall(topath, g.allbones);
#endif
if (findfirst(from))
do {
@@ -199,10 +199,10 @@ int mode;
/* Remove any bones files in `to' directory.
*/
eraseall(topath, allbones);
eraseall(topath, g.allbones);
/* Copy `from' to `to' */
Sprintf(to, "%s%s", topath, allbones);
Sprintf(to, "%s%s", topath, g.allbones);
comspec = getcomspec();
status = spawnl(P_WAIT, comspec, comspec, copy, from, to, "> nul",
(char *) 0);
@@ -216,7 +216,7 @@ int mode;
Sprintf(to, "%s%s", topath, last);
if (findfirst(to)) {
if (mode == TOPERM)
eraseall(frompath, allbones);
eraseall(frompath, g.allbones);
return;
}
@@ -225,7 +225,7 @@ error_copying:
#endif
/* Last file didn't get there.
*/
Sprintf(to, "%s%s", topath, allbones);
Sprintf(to, "%s%s", topath, g.allbones);
msmsg("Can't copy \"%s\" to \"%s\" -- ", from, to);
#ifndef TOS
if (status < 0)
@@ -236,10 +236,10 @@ error_copying:
? "insufficient disk space."
: "bad path(s)?");
if (mode == TOPERM) {
msmsg("Bones will be left in \"%s\"\n", *levels ? levels : hackdir);
msmsg("Bones will be left in \"%s\"\n", *g.levels ? g.levels : hackdir);
} else {
/* Remove all bones files on the RAMdisk */
eraseall(levels, allbones);
eraseall(g.levels, g.allbones);
playwoRAMdisk();
}
return;
@@ -252,10 +252,10 @@ playwoRAMdisk()
msmsg("Do you wish to play without a RAMdisk? [yn] (n)");
/* Set ramdisk false *before* exit-ing (because msexit calls
/* Set g.ramdisk false *before* exit-ing (because msexit calls
* copybones)
*/
ramdisk = FALSE;
g.ramdisk = FALSE;
c = tgetch();
if (c == 'Y')
c = 'y';
@@ -504,7 +504,7 @@ msexit()
enable_ctrlP(); /* in case this wasn't done */
#endif
#ifdef MFLOPPY
if (ramdisk)
if (g.ramdisk)
copybones(TOPERM);
#endif
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)

View File

@@ -209,9 +209,9 @@ char *argv[];
#endif
#ifdef DEF_PAGER
if (!(catmore = nh_getenv("HACKPAGER"))
&& !(catmore = nh_getenv("PAGER")))
catmore = DEF_PAGER;
if (!(g.catmore = nh_getenv("HACKPAGER"))
&& !(g.catmore = nh_getenv("PAGER")))
g.catmore = DEF_PAGER;
#endif
#ifdef MAIL
getmailstatus();
@@ -241,7 +241,7 @@ char *argv[];
if (wizard) {
/* use character name rather than lock letter for file names */
locknum = 0;
g.lockum = 0;
} else {
/* suppress interrupts while processing lock file */
(void) signal(SIGQUIT, SIG_IGN);
@@ -266,14 +266,14 @@ attempt_restore:
/*
* getlock() complains and quits if there is already a game
* in progress for current character name (when locknum == 0)
* or if there are too many active games (when locknum > 0).
* in progress for current character name (when g.lockum == 0)
* or if there are too many active games (when g.lockum > 0).
* When proceeding, it creates an empty <lockname>.0 file to
* designate the current game.
* getlock() constructs <lockname> based on the character
* name (for !locknum) or on first available of alock, block,
* name (for !g.lockum) or on first available of alock, block,
* clock, &c not currently in use in the playground directory
* (for locknum > 0).
* (for g.lockum > 0).
*/
if (*g.plname) {
getlock();
@@ -327,7 +327,7 @@ attempt_restore:
if locking alphabetically, the existing lock file
can still be used; otherwise, discard current one
and create another for the new character name */
if (!locknum) {
if (!g.lockum) {
delete_levelfile(0); /* remove empty lock file */
getlock();
}
@@ -452,17 +452,17 @@ char *argv[];
#else
/* XXX This is deprecated in favor of SYSCF with MAXPLAYERS */
if (argc > 1)
locknum = atoi(argv[1]);
g.lockum = atoi(argv[1]);
#endif
#ifdef MAX_NR_OF_PLAYERS
/* limit to compile-time limit */
if (!locknum || locknum > MAX_NR_OF_PLAYERS)
locknum = MAX_NR_OF_PLAYERS;
if (!g.lockum || g.lockum > MAX_NR_OF_PLAYERS)
g.lockum = MAX_NR_OF_PLAYERS;
#endif
#ifdef SYSCF
/* let syscf override compile-time limit */
if (!locknum || (sysopt.maxplayers && locknum > sysopt.maxplayers))
locknum = sysopt.maxplayers;
if (!g.lockum || (sysopt.maxplayers && g.lockum > sysopt.maxplayers))
g.lockum = sysopt.maxplayers;
#endif
}

View File

@@ -119,15 +119,15 @@ getlock()
/* default value of lock[] is "1lock" where '1' gets changed to
'a','b',&c below; override the default and use <uid><charname>
if we aren't restricting the number of simultaneous games */
if (!locknum)
if (!g.lockum)
Sprintf(lock, "%u%s", (unsigned) getuid(), g.plname);
regularize(lock);
set_levelfile_name(lock, 0);
if (locknum) {
if (locknum > 25)
locknum = 25;
if (g.lockum) {
if (g.lockum > 25)
g.lockum = 25;
do {
lock[0] = 'a' + i++;
@@ -145,7 +145,7 @@ getlock()
if (veryold(fd) && eraseoldlocks())
goto gotlock;
(void) close(fd);
} while (i < locknum);
} while (i < g.lockum);
unlock_file(HLOCK);
error("Too many hacks running now.");

View File

@@ -141,7 +141,7 @@ char *argv[];
if (wizard) {
/* use character name rather than lock letter for file names */
locknum = 0;
g.lockum = 0;
} else {
/* suppress interrupts while processing lock file */
(void) signal(SIGQUIT, SIG_IGN);
@@ -149,14 +149,14 @@ char *argv[];
}
/*
* getlock() complains and quits if there is already a game
* in progress for current character name (when locknum == 0)
* or if there are too many active games (when locknum > 0).
* in progress for current character name (when g.lockum == 0)
* or if there are too many active games (when g.lockum > 0).
* When proceeding, it creates an empty <lockname>.0 file to
* designate the current game.
* getlock() constructs <lockname> based on the character
* name (for !locknum) or on first available of alock, block,
* name (for !g.lockum) or on first available of alock, block,
* clock, &c not currently in use in the playground directory
* (for locknum > 0).
* (for g.lockum > 0).
*/
getlock();
@@ -212,7 +212,7 @@ attempt_restore:
if locking alphabetically, the existing lock file
can still be used; otherwise, discard current one
and create another for the new character name */
if (!locknum) {
if (!g.lockum) {
delete_levelfile(0); /* remove empty lock file */
getlock();
}
@@ -315,10 +315,10 @@ char *argv[];
}
if (argc > 1)
locknum = atoi(argv[1]);
g.lockum = atoi(argv[1]);
#ifdef MAX_NR_OF_PLAYERS
if (!locknum || locknum > MAX_NR_OF_PLAYERS)
locknum = MAX_NR_OF_PLAYERS;
if (!g.lockum || g.lockum > MAX_NR_OF_PLAYERS)
g.lockum = MAX_NR_OF_PLAYERS;
#endif
}

View File

@@ -109,16 +109,16 @@ getlock()
/* default value of lock[] is "1lock" where '1' gets changed to
'a','b',&c below; override the default and use <uid><charname>
if we aren't restricting the number of simultaneous games */
if (!locknum)
if (!g.lockum)
Sprintf(lock, "_%u%s", (unsigned) getuid(), plname);
regularize(lock);
set_levelfile_name(lock, 0);
if (locknum > 25)
locknum = 25;
if (g.lockum > 25)
g.lockum = 25;
do {
if (locknum)
if (g.lockum)
lock[0] = 'a' + i++;
if ((fd = open(lock, 0, 0)) == -1) {
@@ -132,10 +132,10 @@ getlock()
if (veryold(fd)) /* if true, this closes fd and unlinks lock */
goto gotlock;
(void) close(fd);
} while (i < locknum);
} while (i < g.lockum);
unlock_file(HLOCK);
error(locknum ? "Too many hacks running now."
error(g.lockum ? "Too many hacks running now."
: "There is a game in progress under your name.");
gotlock: