UNIX, VMS, DEF_PAGER, MICRO and MFLOPPY globals moved to g.
This commit is contained in:
+16
-7
@@ -8,13 +8,6 @@
|
|||||||
|
|
||||||
#define E extern
|
#define E extern
|
||||||
|
|
||||||
#if defined(UNIX) || defined(VMS)
|
|
||||||
E int locknum;
|
|
||||||
#endif
|
|
||||||
#ifdef DEF_PAGER
|
|
||||||
E char *catmore;
|
|
||||||
#endif /* DEF_PAGER */
|
|
||||||
|
|
||||||
E char SAVEF[];
|
E char SAVEF[];
|
||||||
#ifdef MICRO
|
#ifdef MICRO
|
||||||
E char SAVEP[];
|
E char SAVEP[];
|
||||||
@@ -704,6 +697,22 @@ struct instance_globals {
|
|||||||
struct obj zeroobj; /* used to zero out a struct obj */
|
struct obj zeroobj; /* used to zero out a struct obj */
|
||||||
struct monst zeromonst; /* used to zero out a struct monst */
|
struct monst zeromonst; /* used to zero out a struct monst */
|
||||||
anything zeroany; /* used to zero out union any */
|
anything zeroany; /* used to zero out union any */
|
||||||
|
#if defined(UNIX) || defined(VMS)
|
||||||
|
int locknum; /* max num of simultaneous users */
|
||||||
|
#endif
|
||||||
|
#ifdef DEF_PAGER
|
||||||
|
char *catmore; /* default pager */
|
||||||
|
#endif
|
||||||
|
#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
|
||||||
|
|
||||||
/* dig.c */
|
/* dig.c */
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,6 @@
|
|||||||
#ifndef MICRO_H
|
#ifndef MICRO_H
|
||||||
#define MICRO_H
|
#define MICRO_H
|
||||||
|
|
||||||
extern const char *alllevels, *allbones;
|
|
||||||
extern char levels[], bones[], permbones[], hackdir[];
|
|
||||||
|
|
||||||
extern int ramdisk;
|
|
||||||
|
|
||||||
#ifndef C
|
#ifndef C
|
||||||
#define C(c) (0x1f & (c))
|
#define C(c) (0x1f & (c))
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+16
-18
@@ -6,12 +6,6 @@
|
|||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
|
|
||||||
/* from xxxmain.c */
|
/* from xxxmain.c */
|
||||||
#if defined(UNIX) || defined(VMS)
|
|
||||||
int locknum = 0; /* max num of simultaneous users */
|
|
||||||
#endif
|
|
||||||
#ifdef DEF_PAGER
|
|
||||||
char *catmore = 0; /* default pager */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const char quitchars[] = " \r\n\033";
|
const char quitchars[] = " \r\n\033";
|
||||||
const char vowels[] = "aeiouAEIOU";
|
const char vowels[] = "aeiouAEIOU";
|
||||||
@@ -23,18 +17,6 @@ NEARDATA long yn_number = 0L;
|
|||||||
|
|
||||||
const char disclosure_options[] = "iavgco";
|
const char disclosure_options[] = "iavgco";
|
||||||
|
|
||||||
#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
|
|
||||||
|
|
||||||
NEARDATA struct sinfo program_state;
|
NEARDATA struct sinfo program_state;
|
||||||
|
|
||||||
/* x/y/z deltas for the 10 movement directions (8 compass pts, 2 up/down) */
|
/* x/y/z deltas for the 10 movement directions (8 compass pts, 2 up/down) */
|
||||||
@@ -298,6 +280,22 @@ const struct instance_globals g_init = {
|
|||||||
DUMMY, /* zeroobj */
|
DUMMY, /* zeroobj */
|
||||||
DUMMY, /* zeromonst */
|
DUMMY, /* zeromonst */
|
||||||
DUMMY, /* zeronay */
|
DUMMY, /* zeronay */
|
||||||
|
#if defined(UNIX) || defined(VMS)
|
||||||
|
0, /* locknum */
|
||||||
|
#endif
|
||||||
|
#ifdef DEF_PAGER
|
||||||
|
NULL, /* catmore */
|
||||||
|
#endif
|
||||||
|
#ifdef MICRO
|
||||||
|
UNDEFINED_VALUES, /* levels */
|
||||||
|
#endif /* MICRO */
|
||||||
|
#ifdef MFLOPPY
|
||||||
|
UNDEFINED_VALUES, /* permbones */
|
||||||
|
FALSE, /*ramdisk */
|
||||||
|
TRUE, /* saveprompt */
|
||||||
|
"levels.*", /* alllevels */
|
||||||
|
"bones*.*", /* allbones */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* dig.c */
|
/* dig.c */
|
||||||
UNDEFINED_VALUE, /* did_dig_msg */
|
UNDEFINED_VALUE, /* did_dig_msg */
|
||||||
|
|||||||
+15
-18
@@ -433,20 +433,20 @@ int prefix;
|
|||||||
void
|
void
|
||||||
set_lock_and_bones()
|
set_lock_and_bones()
|
||||||
{
|
{
|
||||||
if (!ramdisk) {
|
if (!g.ramdisk) {
|
||||||
Strcpy(levels, permbones);
|
Strcpy(levels, g.permbones);
|
||||||
Strcpy(bones, permbones);
|
Strcpy(bones, g.permbones);
|
||||||
}
|
}
|
||||||
append_slash(permbones);
|
append_slash(g.permbones);
|
||||||
append_slash(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(bones);
|
||||||
Strcat(bones, "bonesnn.*");
|
Strcat(bones, "bonesnn.*");
|
||||||
Strcpy(lock, levels);
|
Strcpy(lock, g.levels);
|
||||||
#ifndef AMIGA
|
#ifndef AMIGA
|
||||||
Strcat(lock, alllevels);
|
Strcat(lock, g.alllevels);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -581,9 +581,9 @@ clearlocks()
|
|||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(PC_LOCKING) && defined(MFLOPPY) && !defined(AMIGA)
|
#if !defined(PC_LOCKING) && defined(MFLOPPY) && !defined(AMIGA)
|
||||||
eraseall(levels, alllevels);
|
eraseall(levels, g.alllevels);
|
||||||
if (ramdisk)
|
if (g.ramdisk)
|
||||||
eraseall(permbones, alllevels);
|
eraseall(g.permbones, g.alllevels);
|
||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
register int x;
|
register int x;
|
||||||
@@ -2323,34 +2323,31 @@ char *origbuf;
|
|||||||
if (strlen(bufp) >= PATHLEN)
|
if (strlen(bufp) >= PATHLEN)
|
||||||
bufp[PATHLEN - 1] = '\0';
|
bufp[PATHLEN - 1] = '\0';
|
||||||
Strcpy(levels, bufp);
|
Strcpy(levels, bufp);
|
||||||
ramdisk = (strcmp(permbones, levels) != 0);
|
g.ramdisk = (strcmp(g.permbones, levels) != 0);
|
||||||
ramdisk_specified = TRUE;
|
ramdisk_specified = TRUE;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
} else if (match_varname(buf, "LEVELS", 4)) {
|
} else if (match_varname(buf, "LEVELS", 4)) {
|
||||||
if (strlen(bufp) >= PATHLEN)
|
if (strlen(bufp) >= PATHLEN)
|
||||||
bufp[PATHLEN - 1] = '\0';
|
bufp[PATHLEN - 1] = '\0';
|
||||||
Strcpy(permbones, bufp);
|
Strcpy(g.permbones, bufp);
|
||||||
if (!ramdisk_specified || !*levels)
|
if (!ramdisk_specified || !*levels)
|
||||||
Strcpy(levels, bufp);
|
Strcpy(levels, bufp);
|
||||||
ramdisk = (strcmp(permbones, levels) != 0);
|
g.ramdisk = (strcmp(g.permbones, levels) != 0);
|
||||||
} else if (match_varname(buf, "SAVE", 4)) {
|
} else if (match_varname(buf, "SAVE", 4)) {
|
||||||
#ifdef MFLOPPY
|
|
||||||
extern int saveprompt;
|
|
||||||
#endif
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
if ((ptr = index(bufp, ';')) != 0) {
|
if ((ptr = index(bufp, ';')) != 0) {
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
#ifdef MFLOPPY
|
#ifdef MFLOPPY
|
||||||
if (*(ptr + 1) == 'n' || *(ptr + 1) == 'N') {
|
if (*(ptr + 1) == 'n' || *(ptr + 1) == 'N') {
|
||||||
saveprompt = FALSE;
|
g.g.saveprompt = FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if defined(SYSFLAGS) && defined(MFLOPPY)
|
#if defined(SYSFLAGS) && defined(MFLOPPY)
|
||||||
else
|
else
|
||||||
saveprompt = sysflags.asksavedisk;
|
g.g.g.saveprompt = sysflags.asksavedisk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
(void) strncpy(SAVEP, bufp, SAVESIZE - 1);
|
(void) strncpy(SAVEP, bufp, SAVESIZE - 1);
|
||||||
|
|||||||
+4
-4
@@ -762,15 +762,15 @@ xchar ltmp;
|
|||||||
#ifdef AMIGA
|
#ifdef AMIGA
|
||||||
clearlocks();
|
clearlocks();
|
||||||
#else /* !AMIGA */
|
#else /* !AMIGA */
|
||||||
eraseall(levels, alllevels);
|
eraseall(levels, g.alllevels);
|
||||||
eraseall(levels, allbones);
|
eraseall(levels, g.allbones);
|
||||||
|
|
||||||
/* Perhaps the person would like to play without a
|
/* Perhaps the person would like to play without a
|
||||||
* RAMdisk.
|
* RAMdisk.
|
||||||
*/
|
*/
|
||||||
if (ramdisk) {
|
if (g.ramdisk) {
|
||||||
/* PlaywoRAMdisk may not return, but if it does
|
/* PlaywoRAMdisk may not return, but if it does
|
||||||
* it is certain that ramdisk will be 0.
|
* it is certain that g.ramdisk will be 0.
|
||||||
*/
|
*/
|
||||||
playwoRAMdisk();
|
playwoRAMdisk();
|
||||||
/* Rewind save file and try again */
|
/* Rewind save file and try again */
|
||||||
|
|||||||
+5
-5
@@ -1419,8 +1419,8 @@ int lev;
|
|||||||
{
|
{
|
||||||
char to[PATHLEN], from[PATHLEN];
|
char to[PATHLEN], from[PATHLEN];
|
||||||
|
|
||||||
Sprintf(from, "%s%s", permbones, alllevels);
|
Sprintf(from, "%s%s", g.permbones, g.alllevels);
|
||||||
Sprintf(to, "%s%s", levels, alllevels);
|
Sprintf(to, "%s%s", levels, g.alllevels);
|
||||||
set_levelfile_name(from, lev);
|
set_levelfile_name(from, lev);
|
||||||
set_levelfile_name(to, lev);
|
set_levelfile_name(to, lev);
|
||||||
if (iflags.checkspace) {
|
if (iflags.checkspace) {
|
||||||
@@ -1445,7 +1445,7 @@ swapout_oldest()
|
|||||||
int i, oldest;
|
int i, oldest;
|
||||||
long oldtime;
|
long oldtime;
|
||||||
|
|
||||||
if (!ramdisk)
|
if (!g.ramdisk)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
for (i = 1, oldtime = 0, oldest = 0; i <= maxledgerno(); i++)
|
for (i = 1, oldtime = 0, oldest = 0; i <= maxledgerno(); i++)
|
||||||
if (g.level_info[i].where == ACTIVE
|
if (g.level_info[i].where == ACTIVE
|
||||||
@@ -1455,8 +1455,8 @@ swapout_oldest()
|
|||||||
}
|
}
|
||||||
if (!oldest)
|
if (!oldest)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
Sprintf(from, "%s%s", levels, alllevels);
|
Sprintf(from, "%s%s", levels, g.alllevels);
|
||||||
Sprintf(to, "%s%s", permbones, alllevels);
|
Sprintf(to, "%s%s", g.permbones, g.alllevels);
|
||||||
set_levelfile_name(from, oldest);
|
set_levelfile_name(from, oldest);
|
||||||
set_levelfile_name(to, oldest);
|
set_levelfile_name(to, oldest);
|
||||||
if (wizard) {
|
if (wizard) {
|
||||||
|
|||||||
+1
-1
@@ -211,7 +211,7 @@ const char *path, *files;
|
|||||||
struct FileInfoBlock *fibp;
|
struct FileInfoBlock *fibp;
|
||||||
int chklen;
|
int chklen;
|
||||||
#ifdef BETA
|
#ifdef BETA
|
||||||
if(files != alllevels)panic("eraseall");
|
if(files != g.alllevels)panic("eraseall");
|
||||||
#endif
|
#endif
|
||||||
chklen=(int)index(files,'*')-(int)files;
|
chklen=(int)index(files,'*')-(int)files;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -628,7 +628,7 @@ char *argv[];
|
|||||||
/* Player doesn't want to use a RAM disk
|
/* Player doesn't want to use a RAM disk
|
||||||
*/
|
*/
|
||||||
case 'R':
|
case 'R':
|
||||||
ramdisk = FALSE;
|
g.ramdisk = FALSE;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+14
-14
@@ -167,18 +167,18 @@ int mode;
|
|||||||
char copy[8], *comspec;
|
char copy[8], *comspec;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!ramdisk)
|
if (!g.ramdisk)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Find the name of the last file to be transferred
|
/* 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();
|
foundfile = foundfile_buffer();
|
||||||
last[0] = '\0';
|
last[0] = '\0';
|
||||||
Sprintf(from, "%s%s", frompath, allbones);
|
Sprintf(from, "%s%s", frompath, g.allbones);
|
||||||
topath = (mode == TOPERM) ? permbones : levels;
|
topath = (mode == TOPERM) ? g.permbones : g.levels;
|
||||||
#ifdef TOS
|
#ifdef TOS
|
||||||
eraseall(topath, allbones);
|
eraseall(topath, g.allbones);
|
||||||
#endif
|
#endif
|
||||||
if (findfirst(from))
|
if (findfirst(from))
|
||||||
do {
|
do {
|
||||||
@@ -199,10 +199,10 @@ int mode;
|
|||||||
|
|
||||||
/* Remove any bones files in `to' directory.
|
/* Remove any bones files in `to' directory.
|
||||||
*/
|
*/
|
||||||
eraseall(topath, allbones);
|
eraseall(topath, g.allbones);
|
||||||
|
|
||||||
/* Copy `from' to `to' */
|
/* Copy `from' to `to' */
|
||||||
Sprintf(to, "%s%s", topath, allbones);
|
Sprintf(to, "%s%s", topath, g.allbones);
|
||||||
comspec = getcomspec();
|
comspec = getcomspec();
|
||||||
status = spawnl(P_WAIT, comspec, comspec, copy, from, to, "> nul",
|
status = spawnl(P_WAIT, comspec, comspec, copy, from, to, "> nul",
|
||||||
(char *) 0);
|
(char *) 0);
|
||||||
@@ -216,7 +216,7 @@ int mode;
|
|||||||
Sprintf(to, "%s%s", topath, last);
|
Sprintf(to, "%s%s", topath, last);
|
||||||
if (findfirst(to)) {
|
if (findfirst(to)) {
|
||||||
if (mode == TOPERM)
|
if (mode == TOPERM)
|
||||||
eraseall(frompath, allbones);
|
eraseall(frompath, g.allbones);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ error_copying:
|
|||||||
#endif
|
#endif
|
||||||
/* Last file didn't get there.
|
/* 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);
|
msmsg("Can't copy \"%s\" to \"%s\" -- ", from, to);
|
||||||
#ifndef TOS
|
#ifndef TOS
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
@@ -236,10 +236,10 @@ error_copying:
|
|||||||
? "insufficient disk space."
|
? "insufficient disk space."
|
||||||
: "bad path(s)?");
|
: "bad path(s)?");
|
||||||
if (mode == TOPERM) {
|
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 {
|
} else {
|
||||||
/* Remove all bones files on the RAMdisk */
|
/* Remove all bones files on the RAMdisk */
|
||||||
eraseall(levels, allbones);
|
eraseall(g.levels, g.allbones);
|
||||||
playwoRAMdisk();
|
playwoRAMdisk();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -252,10 +252,10 @@ playwoRAMdisk()
|
|||||||
|
|
||||||
msmsg("Do you wish to play without a RAMdisk? [yn] (n)");
|
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)
|
* copybones)
|
||||||
*/
|
*/
|
||||||
ramdisk = FALSE;
|
g.ramdisk = FALSE;
|
||||||
c = tgetch();
|
c = tgetch();
|
||||||
if (c == 'Y')
|
if (c == 'Y')
|
||||||
c = 'y';
|
c = 'y';
|
||||||
@@ -504,7 +504,7 @@ msexit()
|
|||||||
enable_ctrlP(); /* in case this wasn't done */
|
enable_ctrlP(); /* in case this wasn't done */
|
||||||
#endif
|
#endif
|
||||||
#ifdef MFLOPPY
|
#ifdef MFLOPPY
|
||||||
if (ramdisk)
|
if (g.ramdisk)
|
||||||
copybones(TOPERM);
|
copybones(TOPERM);
|
||||||
#endif
|
#endif
|
||||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
|
|||||||
+14
-14
@@ -209,9 +209,9 @@ char *argv[];
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEF_PAGER
|
#ifdef DEF_PAGER
|
||||||
if (!(catmore = nh_getenv("HACKPAGER"))
|
if (!(g.catmore = nh_getenv("HACKPAGER"))
|
||||||
&& !(catmore = nh_getenv("PAGER")))
|
&& !(g.catmore = nh_getenv("PAGER")))
|
||||||
catmore = DEF_PAGER;
|
g.catmore = DEF_PAGER;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAIL
|
#ifdef MAIL
|
||||||
getmailstatus();
|
getmailstatus();
|
||||||
@@ -241,7 +241,7 @@ char *argv[];
|
|||||||
|
|
||||||
if (wizard) {
|
if (wizard) {
|
||||||
/* use character name rather than lock letter for file names */
|
/* use character name rather than lock letter for file names */
|
||||||
locknum = 0;
|
g.lockum = 0;
|
||||||
} else {
|
} else {
|
||||||
/* suppress interrupts while processing lock file */
|
/* suppress interrupts while processing lock file */
|
||||||
(void) signal(SIGQUIT, SIG_IGN);
|
(void) signal(SIGQUIT, SIG_IGN);
|
||||||
@@ -266,14 +266,14 @@ attempt_restore:
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* getlock() complains and quits if there is already a game
|
* getlock() complains and quits if there is already a game
|
||||||
* in progress for current character name (when locknum == 0)
|
* in progress for current character name (when g.lockum == 0)
|
||||||
* or if there are too many active games (when locknum > 0).
|
* or if there are too many active games (when g.lockum > 0).
|
||||||
* When proceeding, it creates an empty <lockname>.0 file to
|
* When proceeding, it creates an empty <lockname>.0 file to
|
||||||
* designate the current game.
|
* designate the current game.
|
||||||
* getlock() constructs <lockname> based on the character
|
* 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
|
* clock, &c not currently in use in the playground directory
|
||||||
* (for locknum > 0).
|
* (for g.lockum > 0).
|
||||||
*/
|
*/
|
||||||
if (*g.plname) {
|
if (*g.plname) {
|
||||||
getlock();
|
getlock();
|
||||||
@@ -327,7 +327,7 @@ attempt_restore:
|
|||||||
if locking alphabetically, the existing lock file
|
if locking alphabetically, the existing lock file
|
||||||
can still be used; otherwise, discard current one
|
can still be used; otherwise, discard current one
|
||||||
and create another for the new character name */
|
and create another for the new character name */
|
||||||
if (!locknum) {
|
if (!g.lockum) {
|
||||||
delete_levelfile(0); /* remove empty lock file */
|
delete_levelfile(0); /* remove empty lock file */
|
||||||
getlock();
|
getlock();
|
||||||
}
|
}
|
||||||
@@ -452,17 +452,17 @@ char *argv[];
|
|||||||
#else
|
#else
|
||||||
/* XXX This is deprecated in favor of SYSCF with MAXPLAYERS */
|
/* XXX This is deprecated in favor of SYSCF with MAXPLAYERS */
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
locknum = atoi(argv[1]);
|
g.lockum = atoi(argv[1]);
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAX_NR_OF_PLAYERS
|
#ifdef MAX_NR_OF_PLAYERS
|
||||||
/* limit to compile-time limit */
|
/* limit to compile-time limit */
|
||||||
if (!locknum || locknum > MAX_NR_OF_PLAYERS)
|
if (!g.lockum || g.lockum > MAX_NR_OF_PLAYERS)
|
||||||
locknum = MAX_NR_OF_PLAYERS;
|
g.lockum = MAX_NR_OF_PLAYERS;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SYSCF
|
#ifdef SYSCF
|
||||||
/* let syscf override compile-time limit */
|
/* let syscf override compile-time limit */
|
||||||
if (!locknum || (sysopt.maxplayers && locknum > sysopt.maxplayers))
|
if (!g.lockum || (sysopt.maxplayers && g.lockum > sysopt.maxplayers))
|
||||||
locknum = sysopt.maxplayers;
|
g.lockum = sysopt.maxplayers;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -119,15 +119,15 @@ getlock()
|
|||||||
/* default value of lock[] is "1lock" where '1' gets changed to
|
/* default value of lock[] is "1lock" where '1' gets changed to
|
||||||
'a','b',&c below; override the default and use <uid><charname>
|
'a','b',&c below; override the default and use <uid><charname>
|
||||||
if we aren't restricting the number of simultaneous games */
|
if we aren't restricting the number of simultaneous games */
|
||||||
if (!locknum)
|
if (!g.lockum)
|
||||||
Sprintf(lock, "%u%s", (unsigned) getuid(), g.plname);
|
Sprintf(lock, "%u%s", (unsigned) getuid(), g.plname);
|
||||||
|
|
||||||
regularize(lock);
|
regularize(lock);
|
||||||
set_levelfile_name(lock, 0);
|
set_levelfile_name(lock, 0);
|
||||||
|
|
||||||
if (locknum) {
|
if (g.lockum) {
|
||||||
if (locknum > 25)
|
if (g.lockum > 25)
|
||||||
locknum = 25;
|
g.lockum = 25;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
lock[0] = 'a' + i++;
|
lock[0] = 'a' + i++;
|
||||||
@@ -145,7 +145,7 @@ getlock()
|
|||||||
if (veryold(fd) && eraseoldlocks())
|
if (veryold(fd) && eraseoldlocks())
|
||||||
goto gotlock;
|
goto gotlock;
|
||||||
(void) close(fd);
|
(void) close(fd);
|
||||||
} while (i < locknum);
|
} while (i < g.lockum);
|
||||||
|
|
||||||
unlock_file(HLOCK);
|
unlock_file(HLOCK);
|
||||||
error("Too many hacks running now.");
|
error("Too many hacks running now.");
|
||||||
|
|||||||
+9
-9
@@ -141,7 +141,7 @@ char *argv[];
|
|||||||
|
|
||||||
if (wizard) {
|
if (wizard) {
|
||||||
/* use character name rather than lock letter for file names */
|
/* use character name rather than lock letter for file names */
|
||||||
locknum = 0;
|
g.lockum = 0;
|
||||||
} else {
|
} else {
|
||||||
/* suppress interrupts while processing lock file */
|
/* suppress interrupts while processing lock file */
|
||||||
(void) signal(SIGQUIT, SIG_IGN);
|
(void) signal(SIGQUIT, SIG_IGN);
|
||||||
@@ -149,14 +149,14 @@ char *argv[];
|
|||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* getlock() complains and quits if there is already a game
|
* getlock() complains and quits if there is already a game
|
||||||
* in progress for current character name (when locknum == 0)
|
* in progress for current character name (when g.lockum == 0)
|
||||||
* or if there are too many active games (when locknum > 0).
|
* or if there are too many active games (when g.lockum > 0).
|
||||||
* When proceeding, it creates an empty <lockname>.0 file to
|
* When proceeding, it creates an empty <lockname>.0 file to
|
||||||
* designate the current game.
|
* designate the current game.
|
||||||
* getlock() constructs <lockname> based on the character
|
* 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
|
* clock, &c not currently in use in the playground directory
|
||||||
* (for locknum > 0).
|
* (for g.lockum > 0).
|
||||||
*/
|
*/
|
||||||
getlock();
|
getlock();
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ attempt_restore:
|
|||||||
if locking alphabetically, the existing lock file
|
if locking alphabetically, the existing lock file
|
||||||
can still be used; otherwise, discard current one
|
can still be used; otherwise, discard current one
|
||||||
and create another for the new character name */
|
and create another for the new character name */
|
||||||
if (!locknum) {
|
if (!g.lockum) {
|
||||||
delete_levelfile(0); /* remove empty lock file */
|
delete_levelfile(0); /* remove empty lock file */
|
||||||
getlock();
|
getlock();
|
||||||
}
|
}
|
||||||
@@ -315,10 +315,10 @@ char *argv[];
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
locknum = atoi(argv[1]);
|
g.lockum = atoi(argv[1]);
|
||||||
#ifdef MAX_NR_OF_PLAYERS
|
#ifdef MAX_NR_OF_PLAYERS
|
||||||
if (!locknum || locknum > MAX_NR_OF_PLAYERS)
|
if (!g.lockum || g.lockum > MAX_NR_OF_PLAYERS)
|
||||||
locknum = MAX_NR_OF_PLAYERS;
|
g.lockum = MAX_NR_OF_PLAYERS;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -109,16 +109,16 @@ getlock()
|
|||||||
/* default value of lock[] is "1lock" where '1' gets changed to
|
/* default value of lock[] is "1lock" where '1' gets changed to
|
||||||
'a','b',&c below; override the default and use <uid><charname>
|
'a','b',&c below; override the default and use <uid><charname>
|
||||||
if we aren't restricting the number of simultaneous games */
|
if we aren't restricting the number of simultaneous games */
|
||||||
if (!locknum)
|
if (!g.lockum)
|
||||||
Sprintf(lock, "_%u%s", (unsigned) getuid(), plname);
|
Sprintf(lock, "_%u%s", (unsigned) getuid(), plname);
|
||||||
|
|
||||||
regularize(lock);
|
regularize(lock);
|
||||||
set_levelfile_name(lock, 0);
|
set_levelfile_name(lock, 0);
|
||||||
if (locknum > 25)
|
if (g.lockum > 25)
|
||||||
locknum = 25;
|
g.lockum = 25;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (locknum)
|
if (g.lockum)
|
||||||
lock[0] = 'a' + i++;
|
lock[0] = 'a' + i++;
|
||||||
|
|
||||||
if ((fd = open(lock, 0, 0)) == -1) {
|
if ((fd = open(lock, 0, 0)) == -1) {
|
||||||
@@ -132,10 +132,10 @@ getlock()
|
|||||||
if (veryold(fd)) /* if true, this closes fd and unlinks lock */
|
if (veryold(fd)) /* if true, this closes fd and unlinks lock */
|
||||||
goto gotlock;
|
goto gotlock;
|
||||||
(void) close(fd);
|
(void) close(fd);
|
||||||
} while (i < locknum);
|
} while (i < g.lockum);
|
||||||
|
|
||||||
unlock_file(HLOCK);
|
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.");
|
: "There is a game in progress under your name.");
|
||||||
|
|
||||||
gotlock:
|
gotlock:
|
||||||
|
|||||||
+2
-2
@@ -2722,9 +2722,9 @@ boolean complain;
|
|||||||
if (complain)
|
if (complain)
|
||||||
raw_printf("Cannot open %s as stdin.", fname);
|
raw_printf("Cannot open %s as stdin.", fname);
|
||||||
} else {
|
} else {
|
||||||
(void) execlp(catmore, "page", (char *) 0);
|
(void) execlp(g.catmore, "page", (char *) 0);
|
||||||
if (complain)
|
if (complain)
|
||||||
raw_printf("Cannot exec %s.", catmore);
|
raw_printf("Cannot exec %s.", g.catmore);
|
||||||
}
|
}
|
||||||
if (complain)
|
if (complain)
|
||||||
sleep(10); /* want to wait_synch() but stdin is gone */
|
sleep(10); /* want to wait_synch() but stdin is gone */
|
||||||
|
|||||||
Reference in New Issue
Block a user