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

@@ -6,12 +6,6 @@
#include "hack.h"
/* 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 vowels[] = "aeiouAEIOU";
@@ -23,18 +17,6 @@ NEARDATA long yn_number = 0L;
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;
/* 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, /* zeromonst */
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 */
UNDEFINED_VALUE, /* did_dig_msg */

View File

@@ -433,20 +433,20 @@ int prefix;
void
set_lock_and_bones()
{
if (!ramdisk) {
Strcpy(levels, permbones);
Strcpy(bones, permbones);
if (!g.ramdisk) {
Strcpy(levels, g.permbones);
Strcpy(bones, g.permbones);
}
append_slash(permbones);
append_slash(levels);
append_slash(g.permbones);
append_slash(g.levels);
#ifdef AMIGA
strncat(levels, bbs_id, PATHLEN);
#endif
append_slash(bones);
Strcat(bones, "bonesnn.*");
Strcpy(lock, levels);
Strcpy(lock, g.levels);
#ifndef AMIGA
Strcat(lock, alllevels);
Strcat(lock, g.alllevels);
#endif
return;
}
@@ -581,9 +581,9 @@ clearlocks()
return;
#endif
#if !defined(PC_LOCKING) && defined(MFLOPPY) && !defined(AMIGA)
eraseall(levels, alllevels);
if (ramdisk)
eraseall(permbones, alllevels);
eraseall(levels, g.alllevels);
if (g.ramdisk)
eraseall(g.permbones, g.alllevels);
#else
{
register int x;
@@ -2323,34 +2323,31 @@ char *origbuf;
if (strlen(bufp) >= PATHLEN)
bufp[PATHLEN - 1] = '\0';
Strcpy(levels, bufp);
ramdisk = (strcmp(permbones, levels) != 0);
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';
Strcpy(permbones, bufp);
Strcpy(g.permbones, bufp);
if (!ramdisk_specified || !*levels)
Strcpy(levels, bufp);
ramdisk = (strcmp(permbones, levels) != 0);
g.ramdisk = (strcmp(g.permbones, levels) != 0);
} else if (match_varname(buf, "SAVE", 4)) {
#ifdef MFLOPPY
extern int saveprompt;
#endif
char *ptr;
if ((ptr = index(bufp, ';')) != 0) {
*ptr = '\0';
#ifdef MFLOPPY
if (*(ptr + 1) == 'n' || *(ptr + 1) == 'N') {
saveprompt = FALSE;
g.g.saveprompt = FALSE;
}
#endif
}
#if defined(SYSFLAGS) && defined(MFLOPPY)
else
saveprompt = sysflags.asksavedisk;
g.g.g.saveprompt = sysflags.asksavedisk;
#endif
(void) strncpy(SAVEP, bufp, SAVESIZE - 1);

View File

@@ -762,15 +762,15 @@ xchar ltmp;
#ifdef AMIGA
clearlocks();
#else /* !AMIGA */
eraseall(levels, alllevels);
eraseall(levels, allbones);
eraseall(levels, g.alllevels);
eraseall(levels, g.allbones);
/* Perhaps the person would like to play without a
* RAMdisk.
*/
if (ramdisk) {
if (g.ramdisk) {
/* 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();
/* Rewind save file and try again */

View File

@@ -1419,8 +1419,8 @@ int lev;
{
char to[PATHLEN], from[PATHLEN];
Sprintf(from, "%s%s", permbones, alllevels);
Sprintf(to, "%s%s", levels, alllevels);
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) {
@@ -1445,7 +1445,7 @@ swapout_oldest()
int i, oldest;
long oldtime;
if (!ramdisk)
if (!g.ramdisk)
return FALSE;
for (i = 1, oldtime = 0, oldest = 0; i <= maxledgerno(); i++)
if (g.level_info[i].where == ACTIVE
@@ -1455,8 +1455,8 @@ swapout_oldest()
}
if (!oldest)
return FALSE;
Sprintf(from, "%s%s", levels, alllevels);
Sprintf(to, "%s%s", permbones, alllevels);
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) {