split g into multiple structures

The consolidation of global variables from scattered source
files into decl.c and declared in decl.h was begun in 3.7.0.
Their placement in common files was done for centralized
initialization and potential re-initialization during a
"play again" scenario.

It wasn't really necessary for all of them to be housed in a
single huge structure to meet the "play again" requirement,
and the single huge structure has been a little unwieldy when
it comes to maintenance.

Following this commit, instead of one single extremely large structure
named 'g' to house all of the relocated global variables, they
are distributed into several ga through gz.

To make things easy for the developer, each variable is placed
into the struct corresponding to the starting letter of the variable.
That way, no lookup is required in order to know which struct houses
a particular variable, it is a simple match to the starting letter
for all the centralized global variables.

A global variable named 'amulets', would be found in ga.
    ga.amulets
     ^ ^
A global varable named 'move', would be found in gm.
    gm.moves
     ^ ^
A global variable named 'val_for_n_or_more' would be found in gv.
    gv.val_for_n_or_more
     ^ ^
A global variable named 'youmonst' would be found in gy.
    gy.youmonst
     ^ ^
This commit is contained in:
nhmall
2022-11-29 21:53:21 -05:00
parent e64ed2859d
commit 02a48aa8cf
193 changed files with 10764 additions and 10148 deletions

172
src/do.c
View File

@@ -116,7 +116,7 @@ boulder_hits_pool(
if (fills_up && u.uinwater && distu(rx, ry) == 0) {
set_uinwater(0); /* u.uinwater = 0 */
docrt();
g.vision_full_recalc = 1;
gv.vision_full_recalc = 1;
You("find yourself on dry land again!");
} else if (lava && next2u(rx, ry)) {
int dmg;
@@ -164,8 +164,8 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
/* erode_obj() (called from water_damage() or lava_damage()) needs
bhitpos, but that was screwing up wand zapping that called us from
rloco(), so we now restore bhitpos before we return */
save_bhitpos = g.bhitpos;
g.bhitpos.x = x, g.bhitpos.y = y;
save_bhitpos = gb.bhitpos;
gb.bhitpos.x = x, gb.bhitpos.y = y;
if (obj->otyp == BOULDER && boulder_hits_pool(obj, x, y, FALSE)) {
res = TRUE;
@@ -191,7 +191,7 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
might have been thrown by a giant or launched by
a rolling boulder trap triggered by a monster or
dropped by a scroll of earth read by a monster */
if (g.context.mon_moving) {
if (gc.context.mon_moving) {
/* normally we'd use ohitmon() but it can call
drop_throw() which calls flooreffects() */
damage = dmgval(obj, mtmp);
@@ -212,7 +212,7 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
}
mtmp->mtrapped = 0;
} else {
if (!Passes_walls && !throws_rocks(g.youmonst.data)) {
if (!Passes_walls && !throws_rocks(gy.youmonst.data)) {
losehp(Maybe_Half_Phys(rnd(15)),
"squished under a boulder", NO_KILLER_PREFIX);
goto deletedwithboulder;
@@ -288,7 +288,7 @@ flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb)
res = (boolean) !obj;
}
g.bhitpos = save_bhitpos;
gb.bhitpos = save_bhitpos;
return res;
}
@@ -345,7 +345,7 @@ polymorph_sink(void)
return;
sinklooted = levl[u.ux][u.uy].looted != 0;
g.level.flags.nsinks--;
gl.level.flags.nsinks--;
levl[u.ux][u.uy].doormask = 0; /* levl[][].flags */
switch (rn2(4)) {
default:
@@ -355,7 +355,7 @@ polymorph_sink(void)
levl[u.ux][u.uy].blessedftn = 0;
if (sinklooted)
SET_FOUNTAIN_LOOTED(u.ux, u.uy);
g.level.flags.nfountains++;
gl.level.flags.nfountains++;
break;
case 1:
sym = S_throne;
@@ -482,7 +482,7 @@ dosinkring(struct obj *obj)
break;
case RIN_HUNGER:
ideed = FALSE;
for (otmp = g.level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
for (otmp = gl.level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
otmp2 = otmp->nexthere;
if (otmp != uball && otmp != uchain
&& !obj_resists(otmp, 1, 99)) {
@@ -741,7 +741,7 @@ dropz(struct obj *obj, boolean with_impact)
container_impact_dmg(obj, u.ux, u.uy);
if (obj == uball)
drop_ball(u.ux, u.uy);
else if (g.level.flags.has_shop)
else if (gl.level.flags.has_shop)
sellobj(obj, u.ux, u.uy);
stackobj(obj);
if (Blind && Levitation)
@@ -819,7 +819,7 @@ obj_no_longer_held(struct obj *obj)
*/
if (!obj->oerodeproof || !rn2(10)) {
/* if monsters aren't moving, assume player is responsible */
if (!g.context.mon_moving && !g.program_state.gameover)
if (!gc.context.mon_moving && !gp.program_state.gameover)
costly_alteration(obj, COST_DEGRD);
obj->otyp = WORM_TOOTH;
obj->oerodeproof = 0;
@@ -834,7 +834,7 @@ doddrop(void)
{
int result = ECMD_OK;
if (!g.invent) {
if (!gi.invent) {
You("have nothing to drop.");
return ECMD_OK;
}
@@ -883,7 +883,7 @@ menu_drop(int retry)
all_categories = (retry == -2);
} else if (flags.menu_style == MENU_FULL) {
all_categories = FALSE;
n = query_category("Drop what type of items?", g.invent,
n = query_category("Drop what type of items?", gi.invent,
(UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL
| BUC_BLESSED | BUC_CURSED | BUC_UNCURSED
| BUC_UNKNOWN | JUSTPICKED | INCLUDE_VENOM),
@@ -924,7 +924,7 @@ menu_drop(int retry)
* Dropping a burning potion of oil while levitating can cause
* an explosion which might destroy some of hero's inventory,
* so the old code
* for (otmp = g.invent; otmp; otmp = otmp2) {
* for (otmp = gi.invent; otmp; otmp = otmp2) {
* otmp2 = otmp->nobj;
* n_dropped += drop(otmp);
* }
@@ -938,23 +938,23 @@ menu_drop(int retry)
* ought to halt the traversal or perhaps ask player whether
* to halt it.
*/
bypass_objlist(g.invent, FALSE); /* clear bypass bit for invent */
while ((otmp = nxt_unbypassed_obj(g.invent)) != 0) {
bypass_objlist(gi.invent, FALSE); /* clear bypass bit for invent */
while ((otmp = nxt_unbypassed_obj(gi.invent)) != 0) {
if (drop_everything || all_categories || allow_category(otmp))
n_dropped += ((drop(otmp) & ECMD_TIME) != 0) ? 1 : 0;
}
/* we might not have dropped everything (worn armor, welded weapon,
cursed loadstones), so reset any remaining inventory to normal */
bypass_objlist(g.invent, FALSE);
} else if (drop_justpicked && count_justpicked(g.invent) == 1) {
bypass_objlist(gi.invent, FALSE);
} else if (drop_justpicked && count_justpicked(gi.invent) == 1) {
/* drop the just picked item automatically, if only one stack */
otmp = find_justpicked(g.invent);
otmp = find_justpicked(gi.invent);
if (otmp)
n_dropped += ((menudrop_split(otmp, justpicked_quan) & ECMD_TIME)
!= 0) ? 1 : 0;
} else {
/* should coordinate with perm invent, maybe not show worn items */
n = query_objlist("What would you like to drop?", &g.invent,
n = query_objlist("What would you like to drop?", &gi.invent,
(USE_INVLET | INVORDER_SORT | INCLUDE_VENOM),
&pick_list, PICK_ANY,
all_categories ? allow_all : allow_category);
@@ -963,18 +963,18 @@ menu_drop(int retry)
* picklist[] contains a set of pointers into inventory, but
* as soon as something gets dropped, they might become stale
* (see the drop_everything code above for an explanation).
* Just checking to see whether one is still in the g.invent
* Just checking to see whether one is still in the gi.invent
* chain is not sufficient validation since destroyed items
* will be freed and items we've split here might have already
* reused that memory and put the same pointer value back into
* g.invent. Ditto for using invlet to validate. So we start
* by setting bypass on all of g.invent, then check each pointer
* to verify that it is in g.invent and has that bit set.
* gi.invent. Ditto for using invlet to validate. So we start
* by setting bypass on all of gi.invent, then check each pointer
* to verify that it is in gi.invent and has that bit set.
*/
bypass_objlist(g.invent, TRUE);
bypass_objlist(gi.invent, TRUE);
for (i = 0; i < n; i++) {
otmp = pick_list[i].item.a_obj;
for (otmp2 = g.invent; otmp2; otmp2 = otmp2->nobj)
for (otmp2 = gi.invent; otmp2; otmp2 = otmp2->nobj)
if (otmp2 == otmp)
break;
if (!otmp2 || !otmp2->bypass)
@@ -983,7 +983,7 @@ menu_drop(int retry)
n_dropped += ((menudrop_split(otmp, pick_list[i].count)
& ECMD_TIME) != 0) ? 1 : 0;
}
bypass_objlist(g.invent, FALSE); /* reset g.invent to normal */
bypass_objlist(gi.invent, FALSE); /* reset gi.invent to normal */
free((genericptr_t) pick_list);
}
}
@@ -1017,11 +1017,11 @@ dodown(void)
if (ELevitation & W_ARTI) {
struct obj *obj;
for (obj = g.invent; obj; obj = obj->nobj) {
for (obj = gi.invent; obj; obj = obj->nobj) {
if (obj->oartifact
&& artifact_has_invprop(obj, LEVITATION)) {
if (obj->age < g.moves)
obj->age = g.moves;
if (obj->age < gm.moves)
obj->age = gm.moves;
obj->age += rnz(100);
}
}
@@ -1077,7 +1077,7 @@ dodown(void)
}
if (u.ustuck) {
if (u.uswallow || !sticks(g.youmonst.data)) {
if (u.uswallow || !sticks(gy.youmonst.data)) {
You("are %s, and cannot go down.",
!u.uswallow ? "being held"
: digests(u.ustuck->data) ? "swallowed"
@@ -1098,7 +1098,7 @@ dodown(void)
return ECMD_TIME;
} else if (!trap || !is_hole(trap->ttyp)
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
if (flags.autodig && !g.context.nopick && uwep && is_pick(uwep)) {
if (flags.autodig && !gc.context.nopick && uwep && is_pick(uwep)) {
return use_pick_axe2(uwep);
} else {
You_cant("go down here%s.",
@@ -1126,7 +1126,7 @@ dodown(void)
const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through";
const char *actn = u_locomotion("jump");
if (g.youmonst.data->msize >= MZ_HUGE) {
if (gy.youmonst.data->msize >= MZ_HUGE) {
char qbuf[QBUFSZ];
You("don't fit %s easily.", down_or_thru);
@@ -1155,9 +1155,9 @@ dodown(void)
(void) clamp_hole_destination(&tdst);
goto_level(&tdst, FALSE, FALSE, FALSE);
} else {
g.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
ga.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
next_level(!trap);
g.at_ladder = FALSE;
ga.at_ladder = FALSE;
}
return ECMD_TIME;
}
@@ -1187,7 +1187,7 @@ doup(void)
return ECMD_OK;
}
if (u.ustuck) {
if (u.uswallow || !sticks(g.youmonst.data)) {
if (u.uswallow || !sticks(gy.youmonst.data)) {
You("are %s, and cannot go up.",
!u.uswallow ? "being held"
: digests(u.ustuck->data) ? "swallowed"
@@ -1216,9 +1216,9 @@ doup(void)
You("are held back by your pet!");
return ECMD_OK;
}
g.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
ga.at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
prev_level(TRUE);
g.at_ladder = FALSE;
ga.at_ladder = FALSE;
return ECMD_TIME;
}
@@ -1255,7 +1255,7 @@ save_currentstate(void)
{
NHFILE *nhfp;
g.program_state.in_checkpoint++;
gp.program_state.in_checkpoint++;
if (flags.ins_chkpt) {
/* write out just-attained level, with pets and everything */
nhfp = currentlevel_rewrite();
@@ -1270,7 +1270,7 @@ save_currentstate(void)
/* write out non-level state */
savestateinlock();
g.program_state.in_checkpoint--;
gp.program_state.in_checkpoint--;
}
#endif
@@ -1305,7 +1305,7 @@ u_collide_m(struct monst *mtmp)
it was already here. Randomly move you to an adjacent spot
or else the monster to any nearby location. Prior to 3.3.0
the latter was done unconditionally. */
if (!rn2(2) && enexto(&cc, u.ux, u.uy, g.youmonst.data)
if (!rn2(2) && enexto(&cc, u.ux, u.uy, gy.youmonst.data)
&& next2u(cc.x, cc.y))
u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
else
@@ -1381,7 +1381,7 @@ goto_level(
*/
if (Inhell && up && u.uhave.amulet && !newdungeon && !portal
&& (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz) - 3)) {
if (!rn2(4 + g.context.mysteryforce)) {
if (!rn2(4 + gc.context.mysteryforce)) {
int odds = 3 + (int) u.ualign.type, /* 2..4 */
diff = (odds <= 1) ? 0 : rn2(odds); /* paranoia */
@@ -1401,7 +1401,7 @@ goto_level(
that drops faster, on average, when being sent down farther so
while the impact is reduced for everybody compared to earlier
versions, it is reduced least for chaotics, most for lawfuls */
g.context.mysteryforce += rn2(diff + 2); /* L:0-4, N:0-3, C:0-2 */
gc.context.mysteryforce += rn2(diff + 2); /* L:0-4, N:0-3, C:0-2 */
if (on_level(newlevel, &u.uz)) {
(void) safe_teleds(FALSE);
@@ -1409,7 +1409,7 @@ goto_level(
return;
}
new_ledger = ledger_no(newlevel);
at_stairs = g.at_ladder = FALSE;
at_stairs = ga.at_ladder = FALSE;
}
}
@@ -1439,7 +1439,7 @@ goto_level(
maybe_reset_pick((struct obj *) 0);
reset_trapset(); /* even if to-be-armed trap obj is accompanying hero */
iflags.travelcc.x = iflags.travelcc.y = 0; /* travel destination cache */
g.context.polearm.hitmon = (struct monst *) 0; /* polearm target */
gc.context.polearm.hitmon = (struct monst *) 0; /* polearm target */
/* digging context is level-aware and can actually be resumed if
hero returns to the previous level without any intervening dig */
@@ -1488,7 +1488,7 @@ goto_level(
for (l_idx = maxledgerno(); l_idx > 0; --l_idx)
delete_levelfile(l_idx);
/* mark #overview data for all dungeon branches as uninteresting */
for (l_idx = 0; l_idx < g.n_dgns; ++l_idx)
for (l_idx = 0; l_idx < gn.n_dgns; ++l_idx)
remdun_mapseen(l_idx);
/* get rid of mons & objs scheduled to migrate to discarded levels */
discard_migrations();
@@ -1518,18 +1518,18 @@ goto_level(
stairway_free_all();
/* set default level change destination areas */
/* the special level code may override these */
(void) memset((genericptr_t) &g.updest, 0, sizeof g.updest);
(void) memset((genericptr_t) &g.dndest, 0, sizeof g.dndest);
(void) memset((genericptr_t) &gu.updest, 0, sizeof gu.updest);
(void) memset((genericptr_t) &gd.dndest, 0, sizeof gd.dndest);
if (!(g.level_info[new_ledger].flags & LFILE_EXISTS)) {
if (!(gl.level_info[new_ledger].flags & LFILE_EXISTS)) {
/* entering this level for first time; make it now */
if (g.level_info[new_ledger].flags & (VISITED)) {
if (gl.level_info[new_ledger].flags & (VISITED)) {
impossible("goto_level: returning to discarded level?");
g.level_info[new_ledger].flags &= ~(VISITED);
gl.level_info[new_ledger].flags &= ~(VISITED);
}
mklev();
new = TRUE; /* made the level */
familiar = bones_include_name(g.plname);
familiar = bones_include_name(gp.plname);
} else {
/* returning to previously visited level; reload it */
nhfp = open_levelfile(new_ledger, whynot);
@@ -1540,7 +1540,7 @@ goto_level(
reseed_random(rn2);
reseed_random(rn2_on_display_rng);
minit(); /* ZEROCOMP */
getlev(nhfp, g.hackpid, new_ledger);
getlev(nhfp, gh.hackpid, new_ledger);
close_nhfile(nhfp);
oinit(); /* reassign level dependent obj probabilities */
}
@@ -1548,14 +1548,14 @@ goto_level(
set_uinwater(0); /* u.uinwater = 0 */
/* do this prior to level-change pline messages */
vision_reset(); /* clear old level's line-of-sight */
g.vision_full_recalc = 0; /* don't let that reenable vision yet */
gv.vision_full_recalc = 0; /* don't let that reenable vision yet */
flush_screen(-1); /* ensure all map flushes are postponed */
if (portal && !In_endgame(&u.uz)) {
/* find the portal on the new level */
register struct trap *ttrap;
for (ttrap = g.ftrap; ttrap; ttrap = ttrap->ntrap)
for (ttrap = gf.ftrap; ttrap; ttrap = ttrap->ntrap)
if (ttrap->ttyp == MAGIC_PORTAL)
break;
@@ -1575,7 +1575,7 @@ goto_level(
}
} else if (at_stairs && !In_endgame(&u.uz)) {
if (up) {
stairway *stway = stairway_find_from(&u.uz0, g.at_ladder);
stairway *stway = stairway_find_from(&u.uz0, ga.at_ladder);
if (stway) {
u_on_newpos(stway->sx, stway->sy);
stway->u_traversed = TRUE;
@@ -1590,10 +1590,10 @@ goto_level(
pline("%s %s up%s the %s.",
great_effort ? "With great effort, you" : "You",
u_locomotion("climb"),
(Flying && g.at_ladder) ? " along" : "",
g.at_ladder ? "ladder" : "stairs");
(Flying && ga.at_ladder) ? " along" : "",
ga.at_ladder ? "ladder" : "stairs");
} else { /* down */
stairway *stway = stairway_find_from(&u.uz0, g.at_ladder);
stairway *stway = stairway_find_from(&u.uz0, ga.at_ladder);
if (stway) {
u_on_newpos(stway->sx, stway->sy);
stway->u_traversed = TRUE;
@@ -1606,10 +1606,10 @@ goto_level(
} else if (Flying) {
if (Verbose(0, go_to_level2))
You("fly down %s.",
g.at_ladder ? "along the ladder" : "the stairs");
ga.at_ladder ? "along the ladder" : "the stairs");
} else if (near_capacity() > UNENCUMBERED
|| Punished || Fumbling) {
You("fall down the %s.", g.at_ladder ? "ladder" : "stairs");
You("fall down the %s.", ga.at_ladder ? "ladder" : "stairs");
if (Punished) {
drag_down();
ballrelease(FALSE);
@@ -1619,13 +1619,13 @@ goto_level(
dismount_steed(DISMOUNT_FELL);
else
losehp(Maybe_Half_Phys(rnd(3)),
g.at_ladder ? "falling off a ladder"
ga.at_ladder ? "falling off a ladder"
: "tumbling down a flight of stairs",
KILLED_BY);
selftouch("Falling, you");
} else { /* ordinary descent */
if (Verbose(0, go_to_level3))
You("%s.", g.at_ladder ? "climb down the ladder"
You("%s.", ga.at_ladder ? "climb down the ladder"
: "descend the stairs");
}
}
@@ -1681,7 +1681,7 @@ goto_level(
'dfr_post_msg' has already been reset to Null];
if 'dfr_post_msg' is "you materialize on a different level" then
maybe_lvltport_feedback() will deliver it now and then free it */
if (g.dfr_post_msg)
if (gd.dfr_post_msg)
maybe_lvltport_feedback(); /* potentially called by Sting_effects() */
/* special levels can have a custom arrival message */
@@ -1749,7 +1749,7 @@ goto_level(
pline_The("heat and smoke are gone.");
} else if (Is_knox(&u.uz)) {
/* alarm stops working once Croesus has died */
if (new || !g.mvitals[PM_CROESUS].died) {
if (new || !gm.mvitals[PM_CROESUS].died) {
You("have penetrated a high security area!");
pline("An alarm sounds!");
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
@@ -1773,7 +1773,7 @@ goto_level(
/* main dungeon message from your quest leader */
if (!In_quest(&u.uz0) && at_dgn_entrance("The Quest")
&& !(u.uevent.qcompleted || u.uevent.qexpelled
|| g.quest_status.leader_is_dead)) {
|| gq.quest_status.leader_is_dead)) {
/* [TODO: copy of same TODO below; if an achievement for
receiving quest call from leader gets added, that should
come after logging new level entry] */
@@ -1845,17 +1845,17 @@ hellish_smoke_mesg(void)
{
if (Inhell && !Is_valley(&u.uz))
pline("It is hot here. You %s smoke...",
olfaction(g.youmonst.data) ? "smell" : "sense");
olfaction(gy.youmonst.data) ? "smell" : "sense");
}
/* usually called from goto_level(); might be called from Sting_effects() */
void
maybe_lvltport_feedback(void)
{
if (g.dfr_post_msg && !strncmpi(g.dfr_post_msg, "You materialize", 15)) {
if (gd.dfr_post_msg && !strncmpi(gd.dfr_post_msg, "You materialize", 15)) {
/* "You materialize on a different level." */
pline("%s", g.dfr_post_msg);
free((genericptr_t) g.dfr_post_msg), g.dfr_post_msg = 0;
pline("%s", gd.dfr_post_msg);
free((genericptr_t) gd.dfr_post_msg), gd.dfr_post_msg = 0;
}
}
@@ -1883,9 +1883,9 @@ schedule_goto(d_level *tolev, int utotype_flags,
assign_level(&u.utolev, tolev);
if (pre_msg)
g.dfr_pre_msg = dupstr(pre_msg);
gd.dfr_pre_msg = dupstr(pre_msg);
if (post_msg)
g.dfr_post_msg = dupstr(post_msg);
gd.dfr_post_msg = dupstr(post_msg);
}
/* handle something like portal ejection */
@@ -1898,8 +1898,8 @@ deferred_goto(void)
assign_level(&dest, &u.utolev);
assign_level(&oldlev, &u.uz);
if (g.dfr_pre_msg)
pline1(g.dfr_pre_msg);
if (gd.dfr_pre_msg)
pline1(gd.dfr_pre_msg);
goto_level(&dest, !!(typmask & UTOTYPE_ATSTAIRS),
!!(typmask & UTOTYPE_FALLING),
!!(typmask & UTOTYPE_PORTAL));
@@ -1911,14 +1911,14 @@ deferred_goto(void)
newsym(u.ux, u.uy);
}
}
if (g.dfr_post_msg && !on_level(&u.uz, &oldlev))
pline1(g.dfr_post_msg);
if (gd.dfr_post_msg && !on_level(&u.uz, &oldlev))
pline1(gd.dfr_post_msg);
}
u.utotype = UTOTYPE_NONE; /* our caller keys off of this */
if (g.dfr_pre_msg)
free((genericptr_t) g.dfr_pre_msg), g.dfr_pre_msg = 0;
if (g.dfr_post_msg)
free((genericptr_t) g.dfr_post_msg), g.dfr_post_msg = 0;
if (gd.dfr_pre_msg)
free((genericptr_t) gd.dfr_pre_msg), gd.dfr_pre_msg = 0;
if (gd.dfr_post_msg)
free((genericptr_t) gd.dfr_post_msg), gd.dfr_post_msg = 0;
}
/*
@@ -2089,7 +2089,7 @@ revive_mon(anything *arg, long timeout UNUSED)
if (!obj_has_timer(body, ROT_CORPSE))
You_feel("%sless hassled.", is_rider(mptr) ? "much " : "");
action = ROT_CORPSE;
when = (long) d(5, 50) - (g.moves - body->age);
when = (long) d(5, 50) - (gm.moves - body->age);
if (when < 1L)
when = 1L;
}
@@ -2105,7 +2105,7 @@ zombify_mon(anything *arg, long timeout)
struct obj *body = arg->a_obj;
int zmon = zombie_form(&mons[body->corpsenm]);
if (zmon != NON_PM && !(g.mvitals[zmon].mvflags & G_GENOD)) {
if (zmon != NON_PM && !(gm.mvitals[zmon].mvflags & G_GENOD)) {
if (has_omid(body))
free_omid(body);
if (has_omonst(body))
@@ -2122,7 +2122,7 @@ boolean
cmd_safety_prevention(const char *cmddesc, const char *act, int *flagcounter)
{
if (flags.safe_wait && !iflags.menu_requested
&& !g.multi && monster_nearby()) {
&& !gm.multi && monster_nearby()) {
char buf[QBUFSZ];
buf[0] = '\0';
@@ -2143,7 +2143,7 @@ donull(void)
{
if (cmd_safety_prevention("a no-op (to rest)",
"Are you waiting to get hit?",
&g.did_nothing_flag))
&gd.did_nothing_flag))
return ECMD_OK;
return ECMD_TIME; /* Do nothing, but let other things happen */
}
@@ -2219,7 +2219,7 @@ set_wounded_legs(long side, int timex)
* You still call this function, but don't lose hp.
* Caller is also responsible for adjusting messages.
*/
g.context.botl = 1;
gc.context.botl = 1;
if (!Wounded_legs)
ATEMP(A_DEX)--;
@@ -2239,7 +2239,7 @@ heal_legs(
int how) /* 0: ordinary, 1: dismounting steed, 2: limbs turn to stone */
{
if (Wounded_legs) {
g.context.botl = 1;
gc.context.botl = 1;
if (ATEMP(A_DEX) < 0)
ATEMP(A_DEX)++;