First set of changes to move globals to instance_globals.

This commit is contained in:
Bart House
2018-11-23 21:29:19 -08:00
parent 616a469f0f
commit 912886a73f
51 changed files with 680 additions and 565 deletions

View File

@@ -769,7 +769,7 @@ const struct Align aligns[] = {
static struct {
boolean roles[SIZE(roles)];
short mask;
} rfilter;
} rfilter = { UNDEFINED_VALUES, UNDEFINED_VALUE};
STATIC_DCL int NDECL(randrole_filtered);
STATIC_DCL char *FDECL(promptsep, (char *, int));
@@ -1757,11 +1757,11 @@ winid where;
not_yet[] = " not yet specified",
rand_choice[] = " random";
char buf[BUFSZ];
int r, c, g, a, allowmask;
int r, c, gend, a, allowmask;
r = flags.initrole;
c = flags.initrace;
g = flags.initgend;
gend = flags.initgend;
a = flags.initalign;
if (r >= 0) {
allowmask = roles[r].allow;
@@ -1770,9 +1770,9 @@ winid where;
else if (c >= 0 && !(allowmask & ROLE_RACEMASK & races[c].allow))
c = ROLE_RANDOM;
if ((allowmask & ROLE_GENDMASK) == ROLE_MALE)
g = 0; /* role forces male (hypothetical) */
gend = 0; /* role forces male (hypothetical) */
else if ((allowmask & ROLE_GENDMASK) == ROLE_FEMALE)
g = 1; /* role forces female (valkyrie) */
gend = 1; /* role forces female (valkyrie) */
if ((allowmask & ROLE_ALIGNMASK) == AM_LAWFUL)
a = 0; /* aligns[lawful] */
else if ((allowmask & ROLE_ALIGNMASK) == AM_NEUTRAL)
@@ -1804,10 +1804,10 @@ winid where;
: roles[r].name.m);
if (r >= 0 && roles[r].name.f) {
/* distinct female name [caveman/cavewoman, priest/priestess] */
if (g == 1)
if (gend == 1)
/* female specified; replace male role name with female one */
Sprintf(index(buf, ':'), ": %s", roles[r].name.f);
else if (g < 0)
else if (gend < 0)
/* gender unspecified; append slash and female role name */
Sprintf(eos(buf), "/%s", roles[r].name.f);
}
@@ -1820,11 +1820,11 @@ winid where;
: races[c].noun);
putstr(where, 0, buf);
Sprintf(buf, "%12s ", "gender:");
Strcat(buf, (which == RS_GENDER) ? choosing : (g == ROLE_NONE)
Strcat(buf, (which == RS_GENDER) ? choosing : (gend == ROLE_NONE)
? not_yet
: (g == ROLE_RANDOM)
: (gend == ROLE_RANDOM)
? rand_choice
: genders[g].adj);
: genders[gend].adj);
putstr(where, 0, buf);
Sprintf(buf, "%12s ", "alignment:");
Strcat(buf, (which == RS_ALGNMNT) ? choosing : (a == ROLE_NONE)
@@ -1852,7 +1852,7 @@ boolean preselect;
anything any;
char buf[BUFSZ];
const char *what = 0, *constrainer = 0, *forcedvalue = 0;
int f = 0, r, c, g, a, i, allowmask;
int f = 0, r, c, gend, a, i, allowmask;
r = flags.initrole;
c = flags.initrace;
@@ -1894,16 +1894,16 @@ boolean preselect;
case RS_GENDER:
what = "gender";
f = flags.initgend;
g = ROLE_NONE;
gend = ROLE_NONE;
if (r >= 0) {
allowmask = roles[r].allow & ROLE_GENDMASK;
if (allowmask == ROLE_MALE)
g = 0; /* genders[male] */
gend = 0; /* genders[male] */
else if (allowmask == ROLE_FEMALE)
g = 1; /* genders[female] */
if (g >= 0) {
gend = 1; /* genders[female] */
if (gend >= 0) {
constrainer = "role";
forcedvalue = genders[g].adj;
forcedvalue = genders[gend].adj;
} else if (f >= 0
&& (allowmask & ~rfilter.mask) == genders[f].allow) {
/* if there is only one gender choice available due to user