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

@@ -39,9 +39,6 @@ STATIC_DCL boolean FDECL(thitm, (int, struct monst *, struct obj *, int,
BOOLEAN_P));
STATIC_DCL void NDECL(maybe_finish_sokoban);
/* mintrap() should take a flags argument, but for time being we use this */
STATIC_VAR int force_mintrap = 0;
STATIC_VAR const char *const a_your[2] = { "a", "your" };
STATIC_VAR const char *const A_Your[2] = { "A", "Your" };
STATIC_VAR const char tower_of_flame[] = "tower of flame";
@@ -2165,7 +2162,7 @@ register struct monst *mtmp;
} else {
register int tt = trap->ttyp;
boolean in_sight, tear_web, see_it,
inescapable = force_mintrap || ((tt == HOLE || tt == PIT)
inescapable = g.force_mintrap || ((tt == HOLE || tt == PIT)
&& Sokoban && !trap->madeby_u);
const char *fallverb;
@@ -2281,7 +2278,7 @@ register struct monst *mtmp;
|| mptr == &mons[PM_BUGBEAR])
You_hear("the roaring of an angry bear!");
}
} else if (force_mintrap) {
} else if (g.force_mintrap) {
if (in_sight) {
pline("%s evades %s bear trap!", Monnam(mtmp),
a_your[trap->madeby_u]);
@@ -2430,7 +2427,7 @@ register struct monst *mtmp;
if (is_flyer(mptr) || is_floater(mptr)
|| (mtmp->wormno && count_wsegs(mtmp) > 5)
|| is_clinger(mptr)) {
if (force_mintrap && !Sokoban) {
if (g.force_mintrap && !Sokoban) {
/* openfallingtrap; not inescapable here */
if (in_sight) {
seetrap(trap);
@@ -2467,7 +2464,7 @@ register struct monst *mtmp;
if (is_flyer(mptr) || is_floater(mptr) || mptr == &mons[PM_WUMPUS]
|| (mtmp->wormno && count_wsegs(mtmp) > 5)
|| mptr->msize >= MZ_HUGE) {
if (force_mintrap && !Sokoban) {
if (g.force_mintrap && !Sokoban) {
/* openfallingtrap; not inescapable here */
if (in_sight) {
seetrap(trap);
@@ -2556,7 +2553,7 @@ register struct monst *mtmp;
a_your[trap->madeby_u]);
deltrap(trap);
newsym(mtmp->mx, mtmp->my);
} else if (force_mintrap && !mtmp->mtrapped) {
} else if (g.force_mintrap && !mtmp->mtrapped) {
if (in_sight) {
pline("%s avoids %s spider web!", Monnam(mtmp),
a_your[trap->madeby_u]);
@@ -4694,9 +4691,9 @@ boolean *noticed; /* set to true iff hero notices the effect; */
/* dotrap calls mintrap when mounted hero encounters a web */
if (u.usteed)
dotrapflags |= NOWEBMSG;
++force_mintrap;
++g.force_mintrap;
dotrap(t, dotrapflags);
--force_mintrap;
--g.force_mintrap;
result = (u.utrap != 0);
} else {
if (mon->mtrapped)
@@ -4704,9 +4701,9 @@ boolean *noticed; /* set to true iff hero notices the effect; */
/* you notice it if you see the trap close/tremble/whatever
or if you sense the monster who becomes trapped */
*noticed = cansee(t->tx, t->ty) || canspotmon(mon);
++force_mintrap;
++g.force_mintrap;
result = (mintrap(mon) != 0);
--force_mintrap;
--g.force_mintrap;
}
return result;
}
@@ -4747,9 +4744,9 @@ boolean *noticed; /* set to true iff hero notices the effect; */
*noticed = cansee(t->tx, t->ty) || canspotmon(mon);
/* monster will be angered; mintrap doesn't handle that */
wakeup(mon, TRUE);
++force_mintrap;
++g.force_mintrap;
result = (mintrap(mon) != 0);
--force_mintrap;
--g.force_mintrap;
/* mon might now be on the migrating monsters list */
}
return result;