diff --git a/include/align.h b/include/align.h index 53e7a4b60..1c5d40872 100644 --- a/include/align.h +++ b/include/align.h @@ -13,7 +13,7 @@ typedef struct align { /* alignment & record */ } align; /* bounds for "record" -- respect initial alignments of 10 */ -#define ALIGNLIM (10L + (moves / 200L)) +#define ALIGNLIM (10L + (g.moves / 200L)) #define A_NONE (-128) /* the value range of type */ diff --git a/include/decl.h b/include/decl.h index 10f6fbc3a..147f2bc6c 100644 --- a/include/decl.h +++ b/include/decl.h @@ -154,9 +154,6 @@ struct multishot { boolean s; }; -E NEARDATA long moves, monstermoves; -E NEARDATA long wailmsg; - E const int shield_static[]; #include "spell.h" @@ -178,8 +175,6 @@ E NEARDATA struct obj *invent, *uarm, *uarmc, *uarmh, *uarms, *uarmg, *uarmf, E NEARDATA struct obj *uchain; /* defined only when punished */ E NEARDATA struct obj *uball; -E NEARDATA struct obj *migrating_objs; -E NEARDATA struct obj *billobjs; E NEARDATA struct obj zeroobj; /* for init; &zeroobj used as special value */ @@ -694,6 +689,11 @@ struct instance_globals { struct mkroom rooms[(MAXNROFROOMS + 1) * 2]; struct mkroom *subrooms; dlevel_t level; /* level map */ + long moves; + long monstermoves; /* moves and monstermoves diverge when player is Fast */ + long wailmsg; + struct obj *migrating_objs; /* objects moving to another dungeon level */ + struct obj *billobjs; /* objects not yet paid for */ /* dig.c */ diff --git a/include/obj.h b/include/obj.h index 62e20b7e4..1a1a5b418 100644 --- a/include/obj.h +++ b/include/obj.h @@ -244,7 +244,7 @@ struct obj { /* Eggs and other food */ #define MAX_EGG_HATCH_TIME 200 /* longest an egg can remain unhatched */ #define stale_egg(egg) \ - ((monstermoves - (egg)->age) > (2 * MAX_EGG_HATCH_TIME)) + ((g.monstermoves - (egg)->age) > (2 * MAX_EGG_HATCH_TIME)) #define ofood(o) ((o)->otyp == CORPSE || (o)->otyp == EGG || (o)->otyp == TIN) #define polyfodder(obj) (ofood(obj) && pm_to_cham((obj)->corpsenm) != NON_PM) #define mlevelgain(obj) (ofood(obj) && (obj)->corpsenm == PM_WRAITH) diff --git a/src/allmain.c b/src/allmain.c index e42654ccf..f77ddffc3 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -159,8 +159,8 @@ boolean resuming; youmonst.movement = 0; settrack(); - monstermoves++; - moves++; + g.monstermoves++; + g.moves++; /********************************/ /* once-per-turn things go here */ @@ -196,8 +196,8 @@ boolean resuming; /* moving around while encumbered is hard work */ if (wtcap > MOD_ENCUMBER && u.umoved) { - if (!(wtcap < EXT_ENCUMBER ? moves % 30 - : moves % 10)) { + if (!(wtcap < EXT_ENCUMBER ? g.moves % 30 + : g.moves % 10)) { if (Upolyd && u.mh > 1) { u.mh--; } else if (!Upolyd && u.uhp > 1) { @@ -212,7 +212,7 @@ boolean resuming; if (u.uen < u.uenmax && ((wtcap < MOD_ENCUMBER - && (!(moves % ((MAXULEV + 8 - u.ulevel) + && (!(g.moves % ((MAXULEV + 8 - u.ulevel) * (Role_if(PM_WIZARD) ? 3 : 4) / 6)))) || Energy_regeneration)) { u.uen += rn1( @@ -317,7 +317,7 @@ boolean resuming; if (context.bypasses) clear_bypasses(); if ((u.uhave.amulet || Clairvoyant) && !In_endgame(&u.uz) - && !BClairvoyant && !(moves % 15) && !rn2(2)) + && !BClairvoyant && !(g.moves % 15) && !rn2(2)) do_vicinity_map((struct obj *) 0); if (u.utrap && u.utraptype == TT_LAVA) sink_into_lava(); @@ -429,7 +429,7 @@ boolean resuming; vision_recalc(0); /* vision! */ /* when running in non-tport mode, this gets done through domove() */ if ((!context.run || flags.runmode == RUN_TPORT) - && (g.multi && (!context.travel ? !(g.multi % 7) : !(moves % 7L)))) { + && (g.multi && (!context.travel ? !(g.multi % 7) : !(g.moves % 7L)))) { if (flags.time && context.run) context.botl = 1; display_nhwindow(WIN_MAP, FALSE); @@ -454,10 +454,10 @@ int wtcap; /* eel out of water loses hp, similar to monster eels; as hp gets lower, rate of further loss slows down */ if (u.mh > 1 && !Regeneration && rn2(u.mh) > rn2(8) - && (!Half_physical_damage || !(moves % 2L))) + && (!Half_physical_damage || !(g.moves % 2L))) heal = -1; } else if (u.mh < u.mhmax) { - if (Regeneration || (encumbrance_ok && !(moves % 20L))) + if (Regeneration || (encumbrance_ok && !(g.moves % 20L))) heal = 1; } if (heal) { @@ -474,7 +474,7 @@ int wtcap; for the player, but it didn't make sense for gameplay...] */ if (u.uhp < u.uhpmax && (encumbrance_ok || Regeneration)) { if (u.ulevel > 9) { - if (!(moves % 3L)) { + if (!(g.moves % 3L)) { int Con = (int) ACURR(A_CON); if (Con <= 12) { @@ -486,7 +486,7 @@ int wtcap; } } } else { /* u.ulevel <= 9 */ - if (!(moves % (long) ((MAXULEV + 12) / (u.ulevel + 2) + 1))) + if (!(g.moves % (long) ((MAXULEV + 12) / (u.ulevel + 2) + 1))) heal = 1; } if (Regeneration && !heal) diff --git a/src/apply.c b/src/apply.c index 2f22d68eb..e0f0d3977 100644 --- a/src/apply.c +++ b/src/apply.c @@ -317,9 +317,9 @@ register struct obj *obj; if (!getdir((char *) 0)) return 0; - res = (moves == context.stethoscope_move) + res = (g.moves == context.stethoscope_move) && (youmonst.movement == context.stethoscope_movement); - context.stethoscope_move = moves; + context.stethoscope_move = g.moves; context.stethoscope_movement = youmonst.movement; g.bhitpos.x = u.ux, g.bhitpos.y = u.uy; /* tentative, reset below */ @@ -1059,7 +1059,7 @@ struct obj **optr; #ifdef AMIGA amii_speaker(obj, "aefeaefeaefeaefeaefe", AMII_LOUDER_VOLUME); #endif - obj->age = moves; + obj->age = g.moves; learno = TRUE; wakem = TRUE; @@ -2083,7 +2083,7 @@ long timeout; debugpline0("null figurine in fig_transform()"); return; } - silent = (timeout != monstermoves); /* happened while away */ + silent = (timeout != g.monstermoves); /* happened while away */ okay_spot = get_obj_location(figurine, &cc.x, &cc.y, 0); if (figurine->where == OBJ_INVENT || figurine->where == OBJ_MINVENT) okay_spot = enexto(&cc, cc.x, cc.y, &mons[figurine->corpsenm]); diff --git a/src/artifact.c b/src/artifact.c index 5b15fab4b..5550d8568 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -1422,7 +1422,7 @@ struct obj *obj; if (oart->inv_prop > LAST_PROP) { /* It's a special power, not "just" a property */ - if (obj->age > monstermoves) { + if (obj->age > g.monstermoves) { /* the artifact is tired :-) */ You_feel("that %s %s ignoring you.", the(xname(obj)), otense(obj, "are")); @@ -1430,7 +1430,7 @@ struct obj *obj; obj->age += (long) d(3, 10); return 1; } - obj->age = monstermoves + rnz(100); + obj->age = g.monstermoves + rnz(100); switch (oart->inv_prop) { case TAMING: { @@ -1597,7 +1597,7 @@ struct obj *obj; iprop = u.uprops[oart->inv_prop].intrinsic; boolean on = (eprop & W_ARTI) != 0; /* true if prop just set */ - if (on && obj->age > monstermoves) { + if (on && obj->age > g.monstermoves) { /* the artifact is tired :-) */ u.uprops[oart->inv_prop].extrinsic ^= W_ARTI; You_feel("that %s %s ignoring you.", the(xname(obj)), @@ -1608,7 +1608,7 @@ struct obj *obj; } else if (!on) { /* when turning off property, determine downtime */ /* arbitrary for now until we can tune this -dlc */ - obj->age = monstermoves + rnz(100); + obj->age = g.monstermoves + rnz(100); } if ((eprop & ~W_ARTI) || iprop) { diff --git a/src/attrib.c b/src/attrib.c index 057020c55..e03100375 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -168,7 +168,7 @@ int msgflg; /* positive => no message, zero => message, and */ if (msgflg <= 0) You_feel("%s%s!", (incr > 1 || incr < -1) ? "very " : "", attrstr); context.botl = 1; - if (moves > 1 && (ndx == A_STR || ndx == A_CON)) + if (g.moves > 1 && (ndx == A_STR || ndx == A_CON)) (void) encumber_msg(); return TRUE; } @@ -421,14 +421,14 @@ boolean inc_or_dec; : "Con", (inc_or_dec) ? "inc" : "dec", AEXE(i)); } - if (moves > 0 && (i == A_STR || i == A_CON)) + if (g.moves > 0 && (i == A_STR || i == A_CON)) (void) encumber_msg(); } STATIC_OVL void exerper() { - if (!(moves % 10)) { + if (!(g.moves % 10)) { /* Hunger Checks */ int hs = (u.uhunger > 1000) ? SATIATED : (u.uhunger > 150) @@ -478,7 +478,7 @@ exerper() } /* status checks */ - if (!(moves % 5)) { + if (!(g.moves % 5)) { debugpline0("exerper: Status checks"); if ((HClairvoyant & (INTRINSIC | TIMEOUT)) && !BClairvoyant) exercise(A_WIS, TRUE); @@ -513,11 +513,11 @@ exerchk() /* Check out the periodic accumulations */ exerper(); - if (moves >= context.next_attrib_check) { + if (g.moves >= context.next_attrib_check) { debugpline1("exerchk: ready to test. multi = %d.", g.multi); } /* Are we ready for a test? */ - if (moves >= context.next_attrib_check && !g.multi) { + if (g.moves >= context.next_attrib_check && !g.multi) { debugpline0("exerchk: testing."); /* * Law of diminishing returns (Part II): @@ -971,7 +971,7 @@ newhp() hp += rnd(urole.hpadv.inrnd); if (urace.hpadv.inrnd > 0) hp += rnd(urace.hpadv.inrnd); - if (moves <= 1L) { /* initial hero; skip for polyself to new man */ + if (g.moves <= 1L) { /* initial hero; skip for polyself to new man */ /* Initialize alignment stuff */ u.ualign.type = aligns[flags.initalign].value; u.ualign.record = urole.initrecord; diff --git a/src/botl.c b/src/botl.c index 7369aa011..05074f1d0 100644 --- a/src/botl.c +++ b/src/botl.c @@ -152,7 +152,7 @@ do_statusline2() /* time/move counter */ if (flags.time) - Sprintf(tmmv, "T:%ld", moves); + Sprintf(tmmv, "T:%ld", g.moves); else tmmv[0] = '\0'; tln = strlen(tmmv); @@ -605,7 +605,7 @@ bot_via_windowport() g.blstats[idx][BL_EXP].a.a_long = u.uexp; /* Time (moves) */ - g.blstats[idx][BL_TIME].a.a_long = moves; + g.blstats[idx][BL_TIME].a.a_long = g.moves; /* Hunger */ /* note: u.uhs is unsigned, and 3.6.1's STATUS_HILITE defined @@ -812,7 +812,7 @@ status_eval_next_unhilite() struct istat_s *curr = NULL; long next_unhilite, this_unhilite; - g.bl_hilite_moves = moves; + g.bl_hilite_moves = g.moves; /* figure out when the next unhilight needs to be performed */ next_unhilite = 0L; for (i = 0; i < MAXBLSTATS; ++i) { diff --git a/src/cmd.c b/src/cmd.c index ff83bf3c7..42d0c1ea6 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1822,7 +1822,7 @@ int final; way sooner (in other words, didn't start that way) */ ? (!final ? "now " : "belatedly ") /* atheist (ignored in very early game) */ - : (!u.uconduct.gnostic && moves > 1000L) + : (!u.uconduct.gnostic && g.moves > 1000L) ? "nominally " /* lastly, normal case */ : "", @@ -1902,11 +1902,11 @@ int final; you_are(buf, ""); /* this is shown even if the 'time' option is off */ - if (moves == 1L) { + if (g.moves == 1L) { you_have("just started your adventure", ""); } else { /* 'turns' grates on the nerves in this context... */ - Sprintf(buf, "the dungeon %ld turn%s ago", moves, plur(moves)); + Sprintf(buf, "the dungeon %ld turn%s ago", g.moves, plur(g.moves)); /* same phrasing for current and final: "entered" is unconditional */ enlght_line(You_, "entered ", buf, ""); } @@ -3749,7 +3749,7 @@ long *total_size; count_obj(invent, &count, &size, FALSE, TRUE); count_obj(fobj, &count, &size, FALSE, TRUE); count_obj(g.level.buriedobjlist, &count, &size, FALSE, TRUE); - count_obj(migrating_objs, &count, &size, FALSE, TRUE); + count_obj(g.migrating_objs, &count, &size, FALSE, TRUE); /* DEADMONSTER check not required in this loop since they have no * inventory */ for (mon = fmon; mon; mon = mon->nmon) @@ -3965,9 +3965,9 @@ wiz_show_stats() obj_chain(win, "fobj", fobj, TRUE, &total_obj_count, &total_obj_size); obj_chain(win, "buried", g.level.buriedobjlist, FALSE, &total_obj_count, &total_obj_size); - obj_chain(win, "migrating obj", migrating_objs, FALSE, + obj_chain(win, "migrating obj", g.migrating_objs, FALSE, &total_obj_count, &total_obj_size); - obj_chain(win, "billobjs", billobjs, FALSE, + obj_chain(win, "billobjs", g.billobjs, FALSE, &total_obj_count, &total_obj_size); mon_invent_chain(win, "minvent", fmon, &total_obj_count, &total_obj_size); mon_invent_chain(win, "migrating minvent", g.migrating_mons, diff --git a/src/decl.c b/src/decl.c index a9a8d5030..7e8a60d77 100644 --- a/src/decl.c +++ b/src/decl.c @@ -98,15 +98,6 @@ const int shield_static[SHIELD_COUNT] = { S_ss1, S_ss2, S_ss3, S_ss2, S_ss1, S_ss2, S_ss4, }; -NEARDATA long moves = 1L, monstermoves = 1L; -/* These diverge when player is Fast */ -NEARDATA long wailmsg = 0L; - -/* objects that are moving to another dungeon level */ -NEARDATA struct obj *migrating_objs = (struct obj *) 0; -/* objects not yet paid for */ -NEARDATA struct obj *billobjs = (struct obj *) 0; - /* used to zero all elements of a struct obj and a struct monst */ NEARDATA struct obj zeroobj = DUMMY; NEARDATA struct monst zeromonst = DUMMY; @@ -322,6 +313,11 @@ const struct instance_globals g_init = { DUMMY, /* rooms */ NULL, /* subrooms */ UNDEFINED_VALUES, /* level */ + 1, /* moves */ + 1, /* monstermoves */ + 0, /* wailmsg */ + NULL, /* migrating_objs */ + NULL, /* billobjs */ /* dig.c */ UNDEFINED_VALUE, /* did_dig_msg */ diff --git a/src/dig.c b/src/dig.c index 02829d407..614cedcbb 100644 --- a/src/dig.c +++ b/src/dig.c @@ -460,7 +460,7 @@ dig(VOID_ARGS) newsym(dpx, dpy); } cleanup: - context.digging.lastdigtime = moves; + context.digging.lastdigtime = g.moves; context.digging.quiet = FALSE; context.digging.level.dnum = 0; context.digging.level.dlevel = -1; @@ -1123,8 +1123,8 @@ struct obj *obj; && !context.digging.down && context.digging.pos.x == u.ux && context.digging.pos.y == u.uy - && (moves <= context.digging.lastdigtime + 2 - && moves >= context.digging.lastdigtime)) { + && (g.moves <= context.digging.lastdigtime + 2 + && g.moves >= context.digging.lastdigtime)) { /* avoid messages if repeated autodigging */ g.did_dig_msg = TRUE; context.digging.quiet = TRUE; diff --git a/src/do.c b/src/do.c index 53decb98d..d77662042 100644 --- a/src/do.c +++ b/src/do.c @@ -919,8 +919,8 @@ dodown() for (obj = invent; obj; obj = obj->nobj) { if (obj->oartifact && artifact_has_invprop(obj, LEVITATION)) { - if (obj->age < monstermoves) - obj->age = monstermoves; + if (obj->age < g.monstermoves) + obj->age = g.monstermoves; obj->age += rnz(100); } } @@ -1804,7 +1804,7 @@ long timeout UNUSED; } else { /* rot this corpse away */ You_feel("%sless hassled.", is_rider(mptr) ? "much " : ""); action = ROT_CORPSE; - when = 250L - (monstermoves - body->age); + when = 250L - (g.monstermoves - body->age); if (when < 1L) when = 1L; } diff --git a/src/dog.c b/src/dog.c index 3a1f87c55..8c961da8a 100644 --- a/src/dog.c +++ b/src/dog.c @@ -49,7 +49,7 @@ register struct monst *mtmp; EDOG(mtmp)->dropdist = 10000; EDOG(mtmp)->apport = ACURR(A_CHA); EDOG(mtmp)->whistletime = 0; - EDOG(mtmp)->hungrytime = 1000 + monstermoves; + EDOG(mtmp)->hungrytime = 1000 + g.monstermoves; EDOG(mtmp)->ogoal.x = -1; /* force error if used before set */ EDOG(mtmp)->ogoal.y = -1; EDOG(mtmp)->abuse = 0; @@ -216,7 +216,7 @@ update_mlstmv() for (mon = fmon; mon; mon = mon->nmon) { if (DEADMONSTER(mon)) continue; - mon->mlstmv = monstermoves; + mon->mlstmv = g.monstermoves; } } @@ -359,12 +359,12 @@ boolean with_you; * specify its final destination. */ - if (mtmp->mlstmv < monstermoves - 1L) { + if (mtmp->mlstmv < g.monstermoves - 1L) { /* heal monster for time spent in limbo */ - long nmv = monstermoves - 1L - mtmp->mlstmv; + long nmv = g.monstermoves - 1L - mtmp->mlstmv; mon_catchup_elapsed_time(mtmp, nmv); - mtmp->mlstmv = monstermoves - 1L; + mtmp->mlstmv = g.monstermoves - 1L; /* let monster move a bit on new level (see placement code below) */ wander = (xchar) min(nmv, 8); @@ -424,7 +424,7 @@ boolean with_you; if ((mtmp->mspare1 & MIGR_LEFTOVERS) != 0L) { /* Pick up the rest of the MIGR_TO_SPECIES objects */ - if (migrating_objs) + if (g.migrating_objs) deliver_obj_to_mon(mtmp, 0, DF_ALL); } @@ -542,8 +542,8 @@ long nmv; /* number of moves */ && (carnivorous(mtmp->data) || herbivorous(mtmp->data))) { struct edog *edog = EDOG(mtmp); - if ((monstermoves > edog->hungrytime + 500 && mtmp->mhp < 3) - || (monstermoves > edog->hungrytime + 750)) + if ((g.monstermoves > edog->hungrytime + 500 && mtmp->mhp < 3) + || (g.monstermoves > edog->hungrytime + 750)) mtmp->mtame = mtmp->mpeaceful = 0; } @@ -659,7 +659,7 @@ boolean pets_only; /* true for ascension or final escape */ relmon(mtmp, &g.mydogs); /* move it from map to g.mydogs */ mtmp->mx = mtmp->my = 0; /* avoid mnexto()/MON_AT() problem */ mtmp->wormno = num_segs; - mtmp->mlstmv = monstermoves; + mtmp->mlstmv = g.monstermoves; } else if (mtmp->iswiz) { /* we want to be able to find him when his next resurrection chance comes up, but have him resume his present location @@ -720,7 +720,7 @@ coord *cc; /* optional destination coordinates */ if (In_W_tower(mtmp->mx, mtmp->my, &u.uz)) xyflags |= 2; mtmp->wormno = num_segs; - mtmp->mlstmv = monstermoves; + mtmp->mlstmv = g.monstermoves; mtmp->mtrack[1].x = cc ? cc->x : mtmp->mx; mtmp->mtrack[1].y = cc ? cc->y : mtmp->my; mtmp->mtrack[0].x = xyloc; @@ -785,7 +785,7 @@ register struct obj *obj; when starving; they never eat stone-to-flesh'd meat */ if (mptr == &mons[PM_GHOUL]) { if (obj->otyp == CORPSE) - return (peek_at_iced_corpse_age(obj) + 50L <= monstermoves + return (peek_at_iced_corpse_age(obj) + 50L <= g.monstermoves && fptr != &mons[PM_LIZARD] && fptr != &mons[PM_LICHEN]) ? DOGFOOD @@ -807,7 +807,7 @@ register struct obj *obj; case EGG: return carni ? CADAVER : MANFOOD; case CORPSE: - if ((peek_at_iced_corpse_age(obj) + 50L <= monstermoves + if ((peek_at_iced_corpse_age(obj) + 50L <= g.monstermoves && obj->corpsenm != PM_LIZARD && obj->corpsenm != PM_LICHEN && mptr->mlet != S_FUNGUS) || (acidic(fptr) && !resists_acid(mon)) @@ -915,7 +915,7 @@ register struct obj *obj; if (mtmp->mcanmove && !mtmp->mconf && !mtmp->meating && ((tasty = dogfood(mtmp, obj)) == DOGFOOD || (tasty <= ACCFOOD - && EDOG(mtmp)->hungrytime <= monstermoves))) { + && EDOG(mtmp)->hungrytime <= g.monstermoves))) { /* pet will "catch" and eat this thrown food */ if (canseemon(mtmp)) { boolean big_corpse = @@ -1035,8 +1035,8 @@ boolean was_dead; edog->killed_by_u = 0; edog->abuse = 0; edog->ogoal.x = edog->ogoal.y = -1; - if (was_dead || edog->hungrytime < monstermoves + 500L) - edog->hungrytime = monstermoves + 500L; + if (was_dead || edog->hungrytime < g.monstermoves + 500L) + edog->hungrytime = g.monstermoves + 500L; if (was_dead) { edog->droptime = 0L; edog->dropdist = 10000; diff --git a/src/dogmove.c b/src/dogmove.c index bb697b73a..83de282e5 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -213,8 +213,8 @@ boolean devour; char objnambuf[BUFSZ]; objnambuf[0] = '\0'; - if (edog->hungrytime < monstermoves) - edog->hungrytime = monstermoves; + if (edog->hungrytime < g.monstermoves) + edog->hungrytime = g.monstermoves; nutrit = dog_nutrition(mtmp, obj); deadmimic = (obj->otyp == CORPSE && (obj->corpsenm == PM_SMALL_MIMIC @@ -294,7 +294,7 @@ boolean devour; #ifdef LINT edog->apport = 0; #else - edog->apport += (int) (200L / ((long) edog->dropdist + monstermoves + edog->apport += (int) (200L / ((long) edog->dropdist + g.monstermoves - edog->droptime)); #endif if (mtmp->data == &mons[PM_RUST_MONSTER] && obj->oerodeproof) { @@ -360,9 +360,9 @@ dog_hunger(mtmp, edog) struct monst *mtmp; struct edog *edog; { - if (monstermoves > edog->hungrytime + 500) { + if (g.monstermoves > edog->hungrytime + 500) { if (!carnivorous(mtmp->data) && !herbivorous(mtmp->data)) { - edog->hungrytime = monstermoves + 500; + edog->hungrytime = g.monstermoves + 500; /* but not too high; it might polymorph */ } else if (!edog->mhpmax_penalty) { /* starving pets are limited in healing */ @@ -381,7 +381,7 @@ struct edog *edog; else You_feel("worried about %s.", y_monnam(mtmp)); stop_occupation(); - } else if (monstermoves > edog->hungrytime + 750 + } else if (g.monstermoves > edog->hungrytime + 750 || DEADMONSTER(mtmp)) { dog_died: if (mtmp->mleashed && mtmp != u.usteed) @@ -427,7 +427,7 @@ int udist; if (edog->apport > 1) edog->apport--; edog->dropdist = udist; /* hpscdi!jon */ - edog->droptime = monstermoves; + edog->droptime = g.monstermoves; } } else { if ((obj = g.level.objects[omx][omy]) != 0 @@ -557,7 +557,7 @@ int after, udist, whappr; /* follow player if appropriate */ if (g.gtyp == UNDEF || (g.gtyp != DOGFOOD && g.gtyp != APPORT - && monstermoves < edog->hungrytime)) { + && g.monstermoves < edog->hungrytime)) { g.gx = u.ux; g.gy = u.uy; if (after && udist <= 4 && g.gx == u.ux && g.gy == u.uy) @@ -923,7 +923,7 @@ int after; /* this is extra fast monster movement */ else if (j == 1) goto newdogpos; /* eating something */ - whappr = (monstermoves - edog->whistletime < 5); + whappr = (g.monstermoves - edog->whistletime < 5); } else whappr = 0; @@ -1034,7 +1034,7 @@ int after; /* this is extra fast monster movement */ return 2; if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) && rn2(4) - && mtmp2->mlstmv != monstermoves + && mtmp2->mlstmv != g.monstermoves && !onscary(mtmp->mx, mtmp->my, mtmp2) /* monnear check needed: long worms hit on tail */ && monnear(mtmp2, mtmp->mx, mtmp->my)) { @@ -1087,7 +1087,7 @@ int after; /* this is extra fast monster movement */ cursemsg[i] = TRUE; } else if ((otyp = dogfood(mtmp, obj)) < MANFOOD && (otyp < ACCFOOD - || edog->hungrytime <= monstermoves)) { + || edog->hungrytime <= g.monstermoves)) { /* Note: our dog likes the food so much that he * might eat it even when it conceals a cursed object */ nix = nx; @@ -1142,7 +1142,7 @@ int after; /* this is extra fast monster movement */ /* How hungry is the pet? */ if (!mtmp->isminion) { struct edog *dog = EDOG(mtmp); - hungry = (monstermoves > (dog->hungrytime + 300)); + hungry = (g.monstermoves > (dog->hungrytime + 300)); } /* Identify the best target in a straight line from the pet; diff --git a/src/dokick.c b/src/dokick.c index 07feb214a..565bb4f81 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -1601,7 +1601,7 @@ boolean near_hero; int where; boolean nobreak, noscatter; - for (otmp = migrating_objs; otmp; otmp = otmp2) { + for (otmp = g.migrating_objs; otmp; otmp = otmp2) { otmp2 = otmp->nobj; if (otmp->ox != u.uz.dnum || otmp->oy != u.uz.dlevel) continue; @@ -1685,7 +1685,7 @@ unsigned long deliverflags; maxobj = 1; cnt = 0; - for (otmp = migrating_objs; otmp; otmp = otmp2) { + for (otmp = g.migrating_objs; otmp; otmp = otmp2) { otmp2 = otmp->nobj; where = (int) (otmp->owornmask & 0x7fffL); /* destination code */ if ((where & MIGR_TO_SPECIES) == 0) diff --git a/src/dothrow.c b/src/dothrow.c index 32961dae5..f2fb77abe 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -2012,13 +2012,13 @@ boolean from_invent; at start of this turn, so that "simultaneous" multiple breakage isn't drastically worse than single breakage. (ought to be done via ESHK) */ - if (moves != lastmovetime) + if (g.moves != lastmovetime) peaceful_shk = shkp->mpeaceful; if (stolen_value(obj, x, y, peaceful_shk, FALSE) > 0L && (*o_shop != u.ushops[0] || !inside_shop(u.ux, u.uy)) - && moves != lastmovetime) + && g.moves != lastmovetime) make_angry_shk(shkp, x, y); - lastmovetime = moves; + lastmovetime = g.moves; } } } diff --git a/src/eat.c b/src/eat.c index bc9f04241..826ffd84b 100644 --- a/src/eat.c +++ b/src/eat.c @@ -643,9 +643,9 @@ boolean allowmsg; /* when poly'd into a mind flayer, multiple tentacle hits in one turn cause multiple digestion checks to occur; avoid giving multiple luck penalties for the same attack */ - if (moves == ate_brains) + if (g.moves == ate_brains) return FALSE; - ate_brains = moves; /* ate_anything, not just brains... */ + ate_brains = g.moves; /* ate_anything, not just brains... */ if (!CANNIBAL_ALLOWED() /* non-cannibalistic heroes shouldn't eat own species ever @@ -1604,7 +1604,7 @@ struct obj *otmp; if (!nonrotting_corpse(mnum)) { long age = peek_at_iced_corpse_age(otmp); - rotted = (monstermoves - age) / (10L + rn2(20)); + rotted = (g.monstermoves - age) / (10L + rn2(20)); if (otmp->cursed) rotted += 2L; else if (otmp->blessed) @@ -2317,7 +2317,7 @@ struct obj *otmp; /* worst case rather than random in this calculation to force prompt */ - rotted = (monstermoves - age) / (10L + 0 /* was rn2(20) */); + rotted = (g.monstermoves - age) / (10L + 0 /* was rn2(20) */); if (otmp->cursed) rotted += 2L; else if (otmp->blessed) @@ -2661,7 +2661,7 @@ doeat() context.victual.reqtime = objects[otmp->otyp].oc_delay; if (otmp->otyp != FORTUNE_COOKIE && (otmp->cursed || (!nonrotting_food(otmp->otyp) - && (monstermoves - otmp->age) + && (g.monstermoves - otmp->age) > (otmp->blessed ? 50L : 30L) && (otmp->orotten || !rn2(7))))) { if (rottenfood(otmp)) { @@ -2786,7 +2786,7 @@ gethungry() && !Slow_digestion) u.uhunger--; /* ordinary food consumption */ - if (moves % 2) { /* odd turns */ + if (g.moves % 2) { /* odd turns */ /* Regeneration uses up food, unless due to an artifact */ if ((HRegeneration & ~FROMFORM) || (ERegeneration & ~(W_ARTI | W_WEP))) @@ -2801,7 +2801,7 @@ gethungry() u.uhunger--; /* +0 charged rings don't do anything, so don't affect hunger. Slow digestion cancels move hunger but still causes ring hunger. */ - switch ((int) (moves % 20)) { /* note: use even cases only */ + switch ((int) (g.moves % 20)) { /* note: use even cases only */ case 4: if (uleft && (uleft->spe || !objects[uleft->otyp].oc_charged)) u.uhunger--; diff --git a/src/end.c b/src/end.c index be25f15f2..43d470333 100644 --- a/src/end.c +++ b/src/end.c @@ -1150,7 +1150,7 @@ int how; * On those rare occasions you get hosed immediately, go out * smiling... :-) -3. */ - if (moves <= 1 && how < PANICKED) /* You die... --More-- */ + if (g.moves <= 1 && how < PANICKED) /* You die... --More-- */ pline("Do not pass go. Do not collect 200 %s.", currency(200L)); if (have_windows) @@ -1499,7 +1499,7 @@ int how; } Sprintf(pbuf, "and %ld piece%s of gold, after %ld move%s.", umoney, - plur(umoney), moves, plur(moves)); + plur(umoney), g.moves, plur(g.moves)); dump_forward_putstr(endwin, 0, pbuf, done_stopprint); Sprintf(pbuf, "You were level %d with a maximum of %d hit point%s when you %s.", diff --git a/src/engrave.c b/src/engrave.c index ea6d59f5a..cc8ba228e 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -269,7 +269,7 @@ boolean strict; { register struct engr *ep = engr_at(x, y); - if (ep && ep->engr_type != HEADSTONE && ep->engr_time <= moves) { + if (ep && ep->engr_type != HEADSTONE && ep->engr_time <= g.moves) { return strict ? (fuzzymatch(ep->engr_txt, s, "", TRUE)) : (strstri(ep->engr_txt, s) != 0); } @@ -901,7 +901,7 @@ doengrave() } /* Something has changed the engraving here */ if (*buf) { - make_engr_at(u.ux, u.uy, buf, moves, type); + make_engr_at(u.ux, u.uy, buf, g.moves, type); if (!Blind) pline_The("engraving now reads: \"%s\".", buf); ptext = FALSE; @@ -1147,7 +1147,7 @@ doengrave() Strcpy(buf, oep->engr_txt); (void) strncat(buf, ebuf, BUFSZ - (int) strlen(buf) - 1); /* Put the engraving onto the map */ - make_engr_at(u.ux, u.uy, buf, moves - g.multi, type); + make_engr_at(u.ux, u.uy, buf, g.moves - g.multi, type); if (post_engr_text[0]) pline("%s", post_engr_text); @@ -1215,7 +1215,7 @@ int fd; * normal levels as the player must have finished engraving * to be able to move again. */ - ep->engr_time = moves; + ep->engr_time = g.moves; } } diff --git a/src/hack.c b/src/hack.c index fd2168d11..7012deb37 100644 --- a/src/hack.c +++ b/src/hack.c @@ -279,7 +279,7 @@ moverock() #endif dopush: if (!u.usteed) { - if (moves > lastmovetime + 2 || moves < lastmovetime) + if (g.moves > lastmovetime + 2 || g.moves < lastmovetime) pline("With %s effort you move %s.", throws_rocks(youmonst.data) ? "little" : "great", @@ -288,7 +288,7 @@ moverock() } else pline("%s moves %s.", upstart(y_monnam(u.usteed)), the(xname(otmp))); - lastmovetime = moves; + lastmovetime = g.moves; } /* Move the boulder *after* the message. */ @@ -1882,7 +1882,7 @@ domove() if (context.run && flags.runmode != RUN_TPORT) { /* display every step or every 7th step depending upon mode */ - if (flags.runmode != RUN_LEAP || !(moves % 7L)) { + if (flags.runmode != RUN_LEAP || !(g.moves % 7L)) { if (flags.time) context.botl = 1; curs_on_u(); @@ -1905,7 +1905,7 @@ overexertion() position, but is now called by attack() so that it doesn't execute if you decline to attack a peaceful monster */ gethungry(); - if ((moves % 3L) != 0L && near_capacity() >= HVY_ENCUMBER) { + if ((g.moves % 3L) != 0L && near_capacity() >= HVY_ENCUMBER) { int *hp = (!Upolyd ? &u.uhp : &u.mh); if (*hp > 1) { @@ -2863,10 +2863,10 @@ maybe_wail() SHOCK_RES, FIRE_RES, SLEEP_RES, DISINT_RES, TELEPORT_CONTROL, STEALTH, FAST, INVIS }; - if (moves <= wailmsg + 50) + if (g.moves <= g.wailmsg + 50) return; - wailmsg = moves; + g.wailmsg = g.moves; if (Role_if(PM_WIZARD) || Race_if(PM_ELF) || Role_if(PM_VALKYRIE)) { const char *who; int i, powercnt; diff --git a/src/lock.c b/src/lock.c index 4c7055487..9d6254c12 100644 --- a/src/lock.c +++ b/src/lock.c @@ -195,7 +195,7 @@ boolean destroyit; useup(otmp); } if (box->otyp == ICE_BOX && otmp->otyp == CORPSE) { - otmp->age = monstermoves - otmp->age; /* actual age */ + otmp->age = g.monstermoves - otmp->age; /* actual age */ start_corpse_timeout(otmp); } place_object(otmp, u.ux, u.uy); diff --git a/src/mail.c b/src/mail.c index 9401543fd..292ca3409 100644 --- a/src/mail.c +++ b/src/mail.c @@ -440,7 +440,7 @@ ckmailstatus() return; if (mustgetmail < 0) { #if defined(AMIGA) || defined(MSDOS) || defined(TOS) - mustgetmail = (moves < 2000) ? (100 + rn2(2000)) : (2000 + rn2(3000)); + mustgetmail = (g.moves < 2000) ? (100 + rn2(2000)) : (2000 + rn2(3000)); #endif return; } @@ -498,12 +498,12 @@ ckmailstatus() if (!mailbox || u.uswallow || !flags.biff #ifdef MAILCKFREQ - || moves < laststattime + MAILCKFREQ + || g.moves < laststattime + MAILCKFREQ #endif ) return; - laststattime = moves; + laststattime = g.moves; if (stat(mailbox, &nmstat)) { #ifdef PERMANENT_MAILBOX pline("Cannot get status of MAIL=\"%s\" anymore.", mailbox); @@ -623,8 +623,8 @@ ck_server_admin_msg() static struct stat ost,nst; static long lastchk = 0; - if (moves < lastchk + SERVER_ADMIN_MSG_CKFREQ) return; - lastchk = moves; + if (g.moves < lastchk + SERVER_ADMIN_MSG_CKFREQ) return; + lastchk = g.moves; if (!stat(SERVER_ADMIN_MSG, &nst)) { if (nst.st_mtime > ost.st_mtime) diff --git a/src/makemon.c b/src/makemon.c index cf355629e..73899d762 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -1403,7 +1403,7 @@ int mmflags; mtmp->mstrategy |= STRAT_APPEARMSG; } - if (allow_minvent && migrating_objs) + if (allow_minvent && g.migrating_objs) deliver_obj_to_mon(mtmp, 1, DF_NONE); /* in case of waiting items */ if (!g.in_mklev) @@ -1487,9 +1487,9 @@ register struct permonst *ptr; static NEARDATA s_level *lev; register int alshift; - if (oldmoves != moves) { + if (oldmoves != g.moves) { lev = Is_special(&u.uz); - oldmoves = moves; + oldmoves = g.moves; } switch ((lev) ? lev->flags.align : g.dungeons[u.uz.dnum].flags.align) { default: /* just in case */ diff --git a/src/mcastu.c b/src/mcastu.c index 585032fea..680f8fa67 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -69,7 +69,7 @@ boolean undirected; point_msg = "at you, then curses"; pline("%s points %s.", Monnam(mtmp), point_msg); - } else if ((!(moves % 4) || !rn2(4))) { + } else if ((!(g.moves % 4) || !rn2(4))) { if (!Deaf) Norep("You hear a mumbled curse."); } diff --git a/src/mhitm.c b/src/mhitm.c index d5feede07..a39638830 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -60,9 +60,9 @@ register struct attack *mattk; { boolean farq = (distu(magr->mx, magr->my) > 15); - if (!Deaf && (farq != g.far_noise || moves - g.noisetime > 10)) { + if (!Deaf && (farq != g.far_noise || g.moves - g.noisetime > 10)) { g.far_noise = farq; - g.noisetime = moves; + g.noisetime = g.moves; You_hear("%s%s.", (mattk->aatyp == AT_EXPL) ? "an explosion" : "some noises", farq ? " in the distance" : ""); @@ -342,7 +342,7 @@ register struct monst *magr, *mdef; * some cases, in which case this still counts as its move for the round * and it shouldn't move again. */ - magr->mlstmv = monstermoves; + magr->mlstmv = g.monstermoves; /* Now perform all attacks for the monster. */ for (i = 0; i < NATTK; i++) { diff --git a/src/mhitu.c b/src/mhitu.c index 2acf2ecf0..9d5b1f4f1 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -779,7 +779,7 @@ register struct monst *mtmp; bot(); /* give player a chance of waking up before dying -kaa */ if (sum[i] == 1) { /* successful attack */ - if (u.usleep && u.usleep < monstermoves && !rn2(10)) { + if (u.usleep && u.usleep < g.monstermoves && !rn2(10)) { g.multi = -1; g.nomovemsg = "The combat suddenly awakens you."; } @@ -1463,7 +1463,7 @@ register struct attack *mattk; dmg = 0; } else { if (Role_if(PM_HEALER)) { - if (!Deaf && !(moves % 5)) + if (!Deaf && !(g.moves % 5)) verbalize("Doc, I can't help you unless you cooperate."); dmg = 0; } else diff --git a/src/mkobj.c b/src/mkobj.c index 195cf0751..133142541 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -292,7 +292,7 @@ struct obj *box; case SACK: case OILSKIN_SACK: /* initial inventory: sack starts out empty */ - if (moves <= 1 && !g.in_mklev) { + if (g.moves <= 1 && !g.in_mklev) { n = 0; break; } @@ -761,7 +761,7 @@ boolean artif; otmp = newobj(); *otmp = zeroobj; - otmp->age = monstermoves; + otmp->age = g.monstermoves; otmp->o_id = context.ident++; if (!otmp->o_id) otmp->o_id = context.ident++; /* ident overflowed */ @@ -987,7 +987,7 @@ boolean artif; otmp = mk_artifact(otmp, (aligntyp) A_NONE); /* simulate lacquered armor for samurai */ if (Role_if(PM_SAMURAI) && otmp->otyp == SPLINT_MAIL - && (moves <= 1 || In_quest(&u.uz))) { + && (g.moves <= 1 || In_quest(&u.uz))) { #ifdef UNIXPC /* optimizer bitfield bug */ otmp->oerodeproof = 1; @@ -1169,7 +1169,7 @@ struct obj *body; action = ROT_CORPSE; /* default action: rot away */ rot_adjust = g.in_mklev ? 25 : 10; /* give some variation */ - corpse_age = monstermoves - body->age; + corpse_age = g.monstermoves - body->age; if (corpse_age > ROT_AGE) when = rot_adjust; else @@ -1774,12 +1774,12 @@ struct obj *otmp; if (otmp->otyp == CORPSE && otmp->on_ice) { /* Adjust the age; must be same as obj_timer_checks() for off ice*/ - age = monstermoves - otmp->age; + age = g.monstermoves - otmp->age; retval += age * (ROT_ICE_ADJUSTMENT - 1) / ROT_ICE_ADJUSTMENT; debugpline3( "The %s age has ice modifications: otmp->age = %ld, returning %ld.", s_suffix(doname(otmp)), otmp->age, retval); - debugpline1("Effective age of corpse: %ld.", monstermoves - retval); + debugpline1("Effective age of corpse: %ld.", g.monstermoves - retval); } return retval; } @@ -1818,8 +1818,8 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */ later calculations behave as if it had been on ice during that time (longwinded way of saying this is the inverse of removing it from the ice and of peeking at its age). */ - age = monstermoves - otmp->age; - otmp->age = monstermoves - (age * ROT_ICE_ADJUSTMENT); + age = g.monstermoves - otmp->age; + otmp->age = g.monstermoves - (age * ROT_ICE_ADJUSTMENT); } /* Check for corpses coming off ice */ @@ -1840,7 +1840,7 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */ tleft /= ROT_ICE_ADJUSTMENT; restart_timer = TRUE; /* Adjust the age */ - age = monstermoves - otmp->age; + age = g.monstermoves - otmp->age; otmp->age += age * (ROT_ICE_ADJUSTMENT - 1) / ROT_ICE_ADJUSTMENT; } } @@ -1907,7 +1907,7 @@ struct monst *mtmp; * OBJ_MINVENT monster's invent chain * OBJ_MIGRATING migrating chain * OBJ_BURIED level.buriedobjs chain - * OBJ_ONBILL on billobjs chain + * OBJ_ONBILL on g.billobjs chain */ void obj_extract_self(obj) @@ -1930,13 +1930,13 @@ struct obj *obj; extract_nobj(obj, &obj->ocarry->minvent); break; case OBJ_MIGRATING: - extract_nobj(obj, &migrating_objs); + extract_nobj(obj, &g.migrating_objs); break; case OBJ_BURIED: extract_nobj(obj, &g.level.buriedobjlist); break; case OBJ_ONBILL: - extract_nobj(obj, &billobjs); + extract_nobj(obj, &g.billobjs); break; default: panic("obj_extract_self"); @@ -2055,8 +2055,8 @@ struct obj *obj; panic("add_to_migration: obj not free"); obj->where = OBJ_MIGRATING; - obj->nobj = migrating_objs; - migrating_objs = obj; + obj->nobj = g.migrating_objs; + g.migrating_objs = obj; } void @@ -2243,9 +2243,9 @@ obj_sanity_check() } objlist_sanity(invent, OBJ_INVENT, "invent sanity"); - objlist_sanity(migrating_objs, OBJ_MIGRATING, "migrating sanity"); + objlist_sanity(g.migrating_objs, OBJ_MIGRATING, "migrating sanity"); objlist_sanity(g.level.buriedobjlist, OBJ_BURIED, "buried sanity"); - objlist_sanity(billobjs, OBJ_ONBILL, "bill sanity"); + objlist_sanity(g.billobjs, OBJ_ONBILL, "bill sanity"); mon_obj_sanity(fmon, "minvent sanity"); mon_obj_sanity(g.migrating_mons, "migrating minvent sanity"); @@ -2732,10 +2732,10 @@ struct obj **obj1, **obj2; o2wt = otmp2->oeaten ? otmp2->oeaten : otmp2->owt; /* averaging the relative ages is less likely to overflow than averaging the absolute ages directly */ - agetmp = (((moves - otmp1->age) * o1wt - + (moves - otmp2->age) * o2wt) + agetmp = (((g.moves - otmp1->age) * o1wt + + (g.moves - otmp2->age) * o2wt) / (o1wt + o2wt)); - otmp1->age = moves - agetmp; /* conv. relative back to absolute */ + otmp1->age = g.moves - agetmp; /* conv. relative back to absolute */ otmp1->owt += o2wt; if (otmp1->oeaten) otmp1->oeaten += o2wt; diff --git a/src/mon.c b/src/mon.c index 32ac20acd..edfdbcadb 100644 --- a/src/mon.c +++ b/src/mon.c @@ -754,9 +754,9 @@ movemon() mon->isgd flag so that dmonsfree() will get rid of mon) */ if (mtmp->isgd && !mtmp->mx) { /* parked at <0,0>; eventually isgd should get set to false */ - if (monstermoves > mtmp->mlstmv) { + if (g.monstermoves > mtmp->mlstmv) { (void) gd_move(mtmp); - mtmp->mlstmv = monstermoves; + mtmp->mlstmv = g.monstermoves; } continue; } @@ -1048,7 +1048,7 @@ struct monst *mtmp; while ((otmp3 = otmp->cobj) != 0) { obj_extract_self(otmp3); if (otmp->otyp == ICE_BOX && otmp3->otyp == CORPSE) { - otmp3->age = monstermoves - otmp3->age; + otmp3->age = g.monstermoves - otmp3->age; start_corpse_timeout(otmp3); } (void) mpickobj(mtmp, otmp3); @@ -2899,7 +2899,7 @@ int x, y, distance; continue; if (mtmp->mtame) { if (!mtmp->isminion) - EDOG(mtmp)->whistletime = moves; + EDOG(mtmp)->whistletime = g.moves; /* Clear mtrack. This is to fix up a pet who is stuck "fleeing" its master. */ memset(mtmp->mtrack, 0, sizeof mtmp->mtrack); @@ -3823,7 +3823,7 @@ kill_genocided_monsters() kill_eggs(invent); kill_eggs(fobj); - kill_eggs(migrating_objs); + kill_eggs(g.migrating_objs); kill_eggs(g.level.buriedobjlist); } diff --git a/src/monmove.c b/src/monmove.c index b54760dc6..295a7ce62 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -186,7 +186,7 @@ mon_regen(mon, digest_meal) struct monst *mon; boolean digest_meal; { - if (mon->mhp < mon->mhpmax && (moves % 20 == 0 || regenerates(mon->data))) + if (mon->mhp < mon->mhpmax && (g.moves % 20 == 0 || regenerates(mon->data))) mon->mhp++; if (mon->mspec_used) mon->mspec_used--; diff --git a/src/muse.c b/src/muse.c index 9e8511d89..7d4888e05 100644 --- a/src/muse.c +++ b/src/muse.c @@ -2267,14 +2267,14 @@ boolean stoning; /* True: stop petrification, False: cure stun && confusion */ if (mon->mtame && !mon->isminion && nutrit > 0) { struct edog *edog = EDOG(mon); - if (edog->hungrytime < monstermoves) - edog->hungrytime = monstermoves; + if (edog->hungrytime < g.monstermoves) + edog->hungrytime = g.monstermoves; edog->hungrytime += nutrit; mon->mconf = 0; } /* use up monster's next move */ mon->movement -= NORMAL_SPEED; - mon->mlstmv = monstermoves; + mon->mlstmv = g.monstermoves; } /* decide whether obj can cure petrification; also used when picking up */ @@ -2506,7 +2506,7 @@ boolean by_you; /* true: if mon kills itself, hero gets credit/blame */ } /* use up monster's next move */ mon->movement -= NORMAL_SPEED; - mon->mlstmv = monstermoves; + mon->mlstmv = g.monstermoves; return res; } diff --git a/src/o_init.c b/src/o_init.c index c5de7c58e..a844b2e95 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -360,7 +360,7 @@ boolean credit_hero; exercise(A_WIS, TRUE); } /* moves==1L => initial inventory, gameover => final disclosure */ - if (moves > 1L && !program_state.gameover) { + if (g.moves > 1L && !program_state.gameover) { if (objects[oindx].oc_class == GEM_CLASS) gem_learned(oindx); /* could affect price of unpaid gems */ update_inventory(); diff --git a/src/pickup.c b/src/pickup.c index ed1c28c53..8e20b6d2e 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -2170,7 +2170,7 @@ register struct obj *obj; } } if (Icebox && !age_is_relative(obj)) { - obj->age = monstermoves - obj->age; /* actual age */ + obj->age = g.monstermoves - obj->age; /* actual age */ /* stop any corpse timeouts when frozen */ if (obj->otyp == CORPSE && obj->timed) { long rot_alarm = stop_timer(ROT_CORPSE, obj_to_any(obj)); @@ -2296,7 +2296,7 @@ removed_from_icebox(obj) struct obj *obj; { if (!age_is_relative(obj)) { - obj->age = monstermoves - obj->age; /* actual age */ + obj->age = g.monstermoves - obj->age; /* actual age */ if (obj->otyp == CORPSE) start_corpse_timeout(obj); } @@ -2376,7 +2376,7 @@ boolean makecat, givemsg; /* set_corpsenm() will start the rot timer that was removed when makemon() created SchroedingersBox; start it from now rather than from when this special corpse got created */ - deadcat->age = monstermoves; + deadcat->age = g.monstermoves; set_corpsenm(deadcat, PM_HOUSECAT); deadcat = oname(deadcat, sc); } diff --git a/src/pray.c b/src/pray.c index 60e96589e..e10b81f8f 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1335,7 +1335,7 @@ dosacrifice() return 1; if (otmp->corpsenm == PM_ACID_BLOB - || (monstermoves <= peek_at_iced_corpse_age(otmp) + 50)) { + || (g.monstermoves <= peek_at_iced_corpse_age(otmp) + 50)) { value = mons[otmp->corpsenm].difficulty + 1; if (otmp->oeaten) value = eaten_stat(value, otmp); diff --git a/src/priest.c b/src/priest.c index c96f3799b..7814fb1a5 100644 --- a/src/priest.c +++ b/src/priest.c @@ -406,7 +406,7 @@ int roomno; sanctum = (priest->data == &mons[PM_HIGH_PRIEST] && (Is_sanctum(&u.uz) || In_endgame(&u.uz))); can_speak = (priest->mcanmove && !priest->msleeping); - if (can_speak && !Deaf && moves >= epri_p->intone_time) { + if (can_speak && !Deaf && g.moves >= epri_p->intone_time) { unsigned save_priest = priest->ispriest; /* don't reveal the altar's owner upon temple entry in @@ -417,7 +417,7 @@ int roomno; pline("%s intones:", canseemon(priest) ? Monnam(priest) : "A nearby voice"); priest->ispriest = save_priest; - epri_p->intone_time = moves + (long) d(10, 500); /* ~2505 */ + epri_p->intone_time = g.moves + (long) d(10, 500); /* ~2505 */ /* make sure that we don't suppress entry message when we've just given its "priest intones" introduction */ epri_p->enter_time = 0L; @@ -435,7 +435,7 @@ int roomno; /* repeat visit, or attacked priest before entering */ msg1 = "You desecrate this place by your presence!"; } - } else if (moves >= epri_p->enter_time) { + } else if (g.moves >= epri_p->enter_time) { Sprintf(buf, "Pilgrim, you enter a %s place!", !shrined ? "desecrated" : "sacred"); msg1 = buf; @@ -444,7 +444,7 @@ int roomno; verbalize1(msg1); if (msg2) verbalize1(msg2); - epri_p->enter_time = moves + (long) d(10, 100); /* ~505 */ + epri_p->enter_time = g.moves + (long) d(10, 100); /* ~505 */ } if (!sanctum) { if (!shrined || !p_coaligned(priest) @@ -462,9 +462,9 @@ int roomno; /* give message if we haven't seen it recently or if alignment update has caused it to switch from forbidding to sense-of-peace or vice versa */ - if (moves >= *this_time || *other_time >= *this_time) { + if (g.moves >= *this_time || *other_time >= *this_time) { You(msg1, msg2); - *this_time = moves + (long) d(10, 20); /* ~55 */ + *this_time = g.moves + (long) d(10, 20); /* ~55 */ /* avoid being tricked by the RNG: switch might have just happened and previous random threshold could be larger */ if (*this_time <= *other_time) @@ -630,9 +630,9 @@ register struct monst *priest; } else { verbalize("Thy selfless generosity is deeply appreciated."); if (money_cnt(invent) < (offer * 2L) && coaligned) { - if (strayed && (moves - u.ucleansed) > 5000L) { + if (strayed && (g.moves - u.ucleansed) > 5000L) { u.ualign.record = 0; /* cleanse thee */ - u.ucleansed = moves; + u.ucleansed = g.moves; } else { adjalign(2); } diff --git a/src/questpgr.c b/src/questpgr.c index 3fbf4ca3f..cd2200399 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -232,7 +232,7 @@ unsigned whichchains; break; } if (!qarti) - qarti = find_qarti(migrating_objs); + qarti = find_qarti(g.migrating_objs); } if (!qarti && (whichchains & (1 << OBJ_BURIED)) != 0) qarti = find_qarti(g.level.buriedobjlist); diff --git a/src/region.c b/src/region.c index 90a387605..846e78031 100644 --- a/src/region.c +++ b/src/region.c @@ -627,7 +627,7 @@ int mode; if (!perform_bwrite(mode)) goto skip_lots; - bwrite(fd, (genericptr_t) &moves, sizeof(moves)); /* timestamp */ + bwrite(fd, (genericptr_t) &g.moves, sizeof(g.moves)); /* timestamp */ bwrite(fd, (genericptr_t) &n_regions, sizeof(n_regions)); for (i = 0; i < n_regions; i++) { bwrite(fd, (genericptr_t) ®ions[i]->bounding_box, sizeof(NhRect)); @@ -687,7 +687,7 @@ boolean ghostly; /* If a bones file restore */ if (ghostly) tmstamp = 0; else - tmstamp = (moves - tmstamp); + tmstamp = (g.moves - tmstamp); mread(fd, (genericptr_t) &n_regions, sizeof(n_regions)); max_regions = n_regions; if (n_regions > 0) diff --git a/src/restore.c b/src/restore.c index e7c4c8fb4..4f1035a29 100644 --- a/src/restore.c +++ b/src/restore.c @@ -172,7 +172,7 @@ boolean ghostly; mread(fd, (genericptr_t) tmp_dam, sizeof(*tmp_dam)); if (ghostly) - tmp_dam->when += (monstermoves - g.omoves); + tmp_dam->when += (g.monstermoves - g.omoves); Strcpy(damaged_shops, in_rooms(tmp_dam->place.x, tmp_dam->place.y, SHOPBASE)); if (u.uz.dlevel) { @@ -286,7 +286,7 @@ boolean ghostly, frozen; * immediately after old player died. */ if (ghostly && !frozen && !age_is_relative(otmp)) - otmp->age = monstermoves - g.omoves + otmp->age; + otmp->age = g.monstermoves - g.omoves + otmp->age; /* get contents of a container or statue */ if (Has_contents(otmp)) { @@ -649,7 +649,7 @@ unsigned int *stuckid, *steedid; impossible("restgamestate: lost ball & chain"); } - migrating_objs = restobjchn(fd, FALSE, FALSE); + g.migrating_objs = restobjchn(fd, FALSE, FALSE); g.migrating_mons = restmonchn(fd, FALSE); mread(fd, (genericptr_t) g.mvitals, sizeof(g.mvitals)); @@ -676,8 +676,8 @@ unsigned int *stuckid, *steedid; restore_dungeon(fd); restlevchn(fd); - mread(fd, (genericptr_t) &moves, sizeof moves); - mread(fd, (genericptr_t) &monstermoves, sizeof monstermoves); + mread(fd, (genericptr_t) &g.moves, sizeof g.moves); + mread(fd, (genericptr_t) &g.monstermoves, sizeof g.monstermoves); mread(fd, (genericptr_t) &g.quest_status, sizeof (struct q_score)); mread(fd, (genericptr_t) g.spl_book, (MAXSPELL + 1) * sizeof (struct spell)); restore_artifacts(fd); @@ -1057,7 +1057,7 @@ boolean ghostly; (boolean) ((sfrestinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP)); mread(fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp)); mread(fd, (genericptr_t) &g.omoves, sizeof(g.omoves)); - elapsed = monstermoves - g.omoves; + elapsed = g.monstermoves - g.omoves; mread(fd, (genericptr_t) &g.upstair, sizeof(stairway)); mread(fd, (genericptr_t) &g.dnstair, sizeof(stairway)); mread(fd, (genericptr_t) &g.upladder, sizeof(stairway)); @@ -1091,7 +1091,7 @@ boolean ghostly; /* restobjchn()'s `frozen' argument probably ought to be a callback routine so that we can check for objects being buried under ice */ g.level.buriedobjlist = restobjchn(fd, ghostly, FALSE); - billobjs = restobjchn(fd, ghostly, FALSE); + g.billobjs = restobjchn(fd, ghostly, FALSE); rest_engravings(fd); /* reset level.monsters for new level */ diff --git a/src/save.c b/src/save.c index ea6105fd8..f4b8b9934 100644 --- a/src/save.c +++ b/src/save.c @@ -300,7 +300,7 @@ register int fd, mode; urealtime.start_timing = urealtime.finish_time; save_killers(fd, mode); - /* must come before migrating_objs and g.migrating_mons are freed */ + /* must come before g.migrating_objs and g.migrating_mons are freed */ save_timers(fd, mode, RANGE_GLOBAL); save_light_sources(fd, mode, RANGE_GLOBAL); @@ -314,11 +314,11 @@ register int fd, mode; saveobjchn(fd, (struct obj *) 0, mode); } - saveobjchn(fd, migrating_objs, mode); + saveobjchn(fd, g.migrating_objs, mode); savemonchn(fd, g.migrating_mons, mode); if (release_data(mode)) { invent = 0; - migrating_objs = 0; + g.migrating_objs = 0; g.migrating_mons = 0; } bwrite(fd, (genericptr_t) g.mvitals, sizeof(g.mvitals)); @@ -326,8 +326,8 @@ register int fd, mode; save_dungeon(fd, (boolean) !!perform_bwrite(mode), (boolean) !!release_data(mode)); savelevchn(fd, mode); - bwrite(fd, (genericptr_t) &moves, sizeof moves); - bwrite(fd, (genericptr_t) &monstermoves, sizeof monstermoves); + bwrite(fd, (genericptr_t) &g.moves, sizeof g.moves); + bwrite(fd, (genericptr_t) &g.monstermoves, sizeof g.monstermoves); bwrite(fd, (genericptr_t) &g.quest_status, sizeof(struct q_score)); bwrite(fd, (genericptr_t) g.spl_book, sizeof(struct spell) * (MAXSPELL + 1)); @@ -452,7 +452,7 @@ int mode; } if (mode != FREE_SAVE) { g.level_info[lev].where = ACTIVE; - g.level_info[lev].time = moves; + g.level_info[lev].time = g.moves; g.level_info[lev].size = bytes_counted; } return TRUE; @@ -504,7 +504,7 @@ int mode; savelevl(fd, (boolean) ((sfsaveinfo.sfi1 & SFI1_RLECOMP) == SFI1_RLECOMP)); bwrite(fd, (genericptr_t) g.lastseentyp, sizeof(g.lastseentyp)); - bwrite(fd, (genericptr_t) &monstermoves, sizeof(monstermoves)); + bwrite(fd, (genericptr_t) &g.monstermoves, sizeof(g.monstermoves)); bwrite(fd, (genericptr_t) &g.upstair, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.dnstair, sizeof(stairway)); bwrite(fd, (genericptr_t) &g.upladder, sizeof(stairway)); @@ -530,7 +530,7 @@ skip_lots: savetrapchn(fd, g.ftrap, mode); saveobjchn(fd, fobj, mode); saveobjchn(fd, g.level.buriedobjlist, mode); - saveobjchn(fd, billobjs, mode); + saveobjchn(fd, g.billobjs, mode); if (release_data(mode)) { int x,y; @@ -541,7 +541,7 @@ skip_lots: g.ftrap = 0; fobj = 0; g.level.buriedobjlist = 0; - billobjs = 0; + g.billobjs = 0; /* level.bonesinfo = 0; -- handled by savecemetery() */ } save_engravings(fd, mode); @@ -1360,7 +1360,7 @@ freedynamicdata() freetrapchn(g.ftrap); freeobjchn(fobj); freeobjchn(g.level.buriedobjlist); - freeobjchn(billobjs); + freeobjchn(g.billobjs); free_engravings(); freedamage(); @@ -1369,7 +1369,7 @@ freedynamicdata() free_timers(RANGE_GLOBAL); free_light_sources(RANGE_GLOBAL); freeobjchn(invent); - freeobjchn(migrating_objs); + freeobjchn(g.migrating_objs); freemonchn(g.migrating_mons); freemonchn(g.mydogs); /* ascension or dungeon escape */ /* freelevchn(); -- [folded into free_dungeons()] */ diff --git a/src/shk.c b/src/shk.c index 6e4924167..b41dfa41f 100644 --- a/src/shk.c +++ b/src/shk.c @@ -305,7 +305,7 @@ register struct monst *shkp; for (mtmp = g.migrating_mons; mtmp; mtmp = mtmp->nmon) clear_unpaid(shkp, mtmp->minvent); - while ((obj = billobjs) != 0) { + while ((obj = g.billobjs) != 0) { obj_extract_self(obj); dealloc_obj(obj); } @@ -693,7 +693,7 @@ struct obj *obj; /* if you bring a sack of N picks into a shop to sell, don't repeat this N times when they're taken out */ - if (moves != pickmovetime) { + if (g.moves != pickmovetime) { if (!Deaf && !muteshk(shkp)) verbalize("You sneaky %s! Get out of here with that pick!", cad(FALSE)); @@ -703,7 +703,7 @@ struct obj *obj; haseyes(shkp->data) ? "glares at" : "is dismayed because of"); } - pickmovetime = moves; + pickmovetime = g.moves; } } @@ -1915,7 +1915,7 @@ register struct bill_x *bp; register unsigned int id = bp->bo_id; if (bp->useup) - obj = o_on(id, billobjs); + obj = o_on(id, g.billobjs); else obj = find_oid(id); return obj; @@ -1924,7 +1924,7 @@ register struct bill_x *bp; /* * Look for o_id on all lists but billobj. Return obj or NULL if not found. * Its OK for restore_timers() to call this function, there should not - * be any timeouts on the billobjs chain. + * be any timeouts on the g.billobjs chain. */ struct obj * find_oid(id) @@ -1941,7 +1941,7 @@ unsigned id; return obj; if ((obj = o_on(id, g.level.buriedobjlist)) != 0) return obj; - if ((obj = o_on(id, migrating_objs)) != 0) + if ((obj = o_on(id, g.migrating_objs)) != 0) return obj; /* not found yet; check inventory for members of various monst lists */ @@ -2402,7 +2402,7 @@ struct monst *shkp; bp->bo_id = obj->o_id; bp->bquan = obj->quan; if (dummy) { /* a dummy object must be inserted into */ - bp->useup = 1; /* the billobjs chain here. crucial for */ + bp->useup = 1; /* the g.billobjs chain here. crucial for */ add_to_billobjs(obj); /* eating floorfood in shop. see eat.c */ } else bp->useup = 0; @@ -2420,8 +2420,8 @@ struct obj *obj; if (obj->timed) obj_stop_timers(obj); - obj->nobj = billobjs; - billobjs = obj; + obj->nobj = g.billobjs; + g.billobjs = obj; obj->where = OBJ_ONBILL; } @@ -3360,12 +3360,12 @@ long cost; for (tmp_dam = g.level.damagelist; tmp_dam; tmp_dam = tmp_dam->next) if (tmp_dam->place.x == x && tmp_dam->place.y == y) { tmp_dam->cost += cost; - tmp_dam->when = monstermoves; /* needed by pay_for_damage() */ + tmp_dam->when = g.monstermoves; /* needed by pay_for_damage() */ return; } tmp_dam = (struct damage *) alloc((unsigned) sizeof *tmp_dam); (void) memset((genericptr_t) tmp_dam, 0, sizeof *tmp_dam); - tmp_dam->when = monstermoves; + tmp_dam->when = g.monstermoves; tmp_dam->place.x = x; tmp_dam->place.y = y; tmp_dam->cost = cost; @@ -3521,7 +3521,7 @@ boolean catchup; /* restoring a level */ struct trap *ttmp; int i, k, ix, iy, disposition = 1; - if ((monstermoves - tmp_dam->when) < REPAIR_DELAY) + if ((g.monstermoves - tmp_dam->when) < REPAIR_DELAY) return 0; if (shkp->msleeping || !shkp->mcanmove || ESHK(shkp)->following) return 0; @@ -3692,7 +3692,7 @@ struct monst *shkp; eshkp->following = 0; return 0; } - if (moves > followmsg + 4) { + if (g.moves > followmsg + 4) { if (!Deaf && !muteshk(shkp)) verbalize("%s, %s! Didn't you forget to pay?", Hello(shkp), g.plname); @@ -3700,7 +3700,7 @@ struct monst *shkp; pline("%s holds out %s upturned %s.", Shknam(shkp), noit_mhis(shkp), mbodypart(shkp, HAND)); - followmsg = moves; + followmsg = g.moves; if (!rn2(9)) { pline("%s doesn't like customers who don't pay.", Shknam(shkp)); @@ -3938,7 +3938,7 @@ boolean cant_mollify; for (tmp_dam = g.level.damagelist; tmp_dam; tmp_dam = tmp_dam->next) { char *shp; - if (tmp_dam->when != monstermoves || !tmp_dam->cost) + if (tmp_dam->when != g.monstermoves || !tmp_dam->cost) continue; cost_of_damage += tmp_dam->cost; Strcpy(shops_affected, diff --git a/src/sounds.c b/src/sounds.c index cce616e62..58b53eff0 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -637,9 +637,9 @@ register struct monst *mtmp; } else if (mtmp->mpeaceful) { if (mtmp->mtame && (mtmp->mconf || mtmp->mflee || mtmp->mtrapped - || moves > EDOG(mtmp)->hungrytime || mtmp->mtame < 5)) + || g.moves > EDOG(mtmp)->hungrytime || mtmp->mtame < 5)) pline_msg = "whines."; - else if (mtmp->mtame && EDOG(mtmp)->hungrytime > moves + 1000) + else if (mtmp->mtame && EDOG(mtmp)->hungrytime > g.moves + 1000) pline_msg = "yips."; else { if (mtmp->data @@ -655,9 +655,9 @@ register struct monst *mtmp; if (mtmp->mconf || mtmp->mflee || mtmp->mtrapped || mtmp->mtame < 5) pline_msg = "yowls."; - else if (moves > EDOG(mtmp)->hungrytime) + else if (g.moves > EDOG(mtmp)->hungrytime) pline_msg = "meows."; - else if (EDOG(mtmp)->hungrytime > moves + 1000) + else if (EDOG(mtmp)->hungrytime > g.moves + 1000) pline_msg = "purrs."; else pline_msg = "mews."; @@ -694,7 +694,7 @@ register struct monst *mtmp; case MS_NEIGH: if (mtmp->mtame < 5) pline_msg = "neighs."; - else if (moves > EDOG(mtmp)->hungrytime) + else if (g.moves > EDOG(mtmp)->hungrytime) pline_msg = "whinnies."; else pline_msg = "whickers."; @@ -792,7 +792,7 @@ register struct monst *mtmp; } else if (mtmp->mhp < mtmp->mhpmax / 2) pline_msg = "asks for a potion of healing."; else if (mtmp->mtame && !mtmp->isminion - && moves > EDOG(mtmp)->hungrytime) + && g.moves > EDOG(mtmp)->hungrytime) verbl_msg = "I'm hungry."; /* Specific monsters' interests */ else if (is_elf(ptr)) diff --git a/src/spell.c b/src/spell.c index f7c720dda..b8d14aa0a 100644 --- a/src/spell.c +++ b/src/spell.c @@ -241,7 +241,7 @@ struct obj *book2; arti_cursed = TRUE; } if (otmp->otyp == BELL_OF_OPENING - && (moves - otmp->age) < 5L) { /* you rang it recently */ + && (g.moves - otmp->age) < 5L) { /* you rang it recently */ if (!otmp->cursed) arti2_primed = TRUE; else diff --git a/src/timeout.c b/src/timeout.c index 8bdf0bdc6..1305f7c6a 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -459,7 +459,7 @@ nh_timeout() baseluck -= 1; if (u.uluck != baseluck - && moves % ((u.uhave.amulet || u.ugangr) ? 300 : 600) == 0) { + && g.moves % ((u.uhave.amulet || u.ugangr) ? 300 : 600) == 0) { /* Cursed luckstones stop bad luck from timing out; blessed luckstones * stop good luck from timing out; normal luckstones stop both; * neither is stopped if you don't have a luckstone. @@ -718,7 +718,7 @@ boolean wakeup_msg; g.afternmv = Hear_again; /* this won't give any messages */ } /* early wakeup from combat won't be possible until next monster turn */ - u.usleep = monstermoves; + u.usleep = g.monstermoves; g.nomovemsg = wakeup_msg ? "You wake up." : You_can_move_again; } @@ -787,7 +787,7 @@ long timeout; mnum = big_to_little(egg->corpsenm); /* The identity of one's father is learned, not innate */ yours = (egg->spe || (!flags.female && carried(egg) && !rn2(2))); - silent = (timeout != monstermoves); /* hatched while away */ + silent = (timeout != g.monstermoves); /* hatched while away */ /* only can hatch when in INVENT, FLOOR, MINVENT */ if (get_obj_location(egg, &x, &y, 0)) { @@ -1107,8 +1107,8 @@ long timeout; many = menorah ? obj->spe > 1 : obj->quan > 1L; /* timeout while away */ - if (timeout != monstermoves) { - long how_long = monstermoves - timeout; + if (timeout != g.monstermoves) { + long how_long = g.monstermoves - timeout; if (how_long >= obj->age) { obj->age = 0; @@ -1537,7 +1537,7 @@ long expire_time; del_light_source(LS_OBJECT, obj_to_any(obj)); /* restore unused time */ - obj->age += expire_time - monstermoves; + obj->age += expire_time - g.monstermoves; obj->lamplit = 0; @@ -1601,7 +1601,7 @@ do_storms() * boolean start_timer(long timeout,short kind,short func_index, * anything *arg) * Start a timer of kind 'kind' that will expire at time - * monstermoves+'timeout'. Call the function at 'func_index' + * g.monstermoves+'timeout'. Call the function at 'func_index' * in the timeout table using argument 'arg'. Return TRUE if * a timer was started. This places the timer on a list ordered * "sooner" to "later". If an object, increment the object's @@ -1748,7 +1748,7 @@ wiz_timeout_queue() if (win == WIN_ERR) return 0; - Sprintf(buf, "Current time = %ld.", monstermoves); + Sprintf(buf, "Current time = %ld.", g.monstermoves); putstr(win, 0, buf); putstr(win, 0, ""); putstr(win, 0, "Active timeout queue:"); @@ -1832,7 +1832,7 @@ run_timers() * any time. The list is ordered, we are done when the first element * is in the future. */ - while (g.timer_base && g.timer_base->timeout <= monstermoves) { + while (g.timer_base && g.timer_base->timeout <= g.monstermoves) { curr = g.timer_base; g.timer_base = curr->next; @@ -1862,7 +1862,7 @@ anything *arg; (void) memset((genericptr_t)gnu, 0, sizeof(timer_element)); gnu->next = 0; gnu->tid = g.timer_id++; - gnu->timeout = monstermoves + when; + gnu->timeout = g.monstermoves + when; gnu->kind = kind; gnu->needs_fixup = 0; gnu->func_index = func_index; @@ -1897,7 +1897,7 @@ anything *arg; if (timeout_funcs[doomed->func_index].cleanup) (*timeout_funcs[doomed->func_index].cleanup)(arg, timeout); free((genericptr_t) doomed); - return (timeout - monstermoves); + return (timeout - g.monstermoves); } return 0L; } @@ -1952,7 +1952,7 @@ struct obj *src, *dest; for (curr = g.timer_base; curr; curr = next_timer) { next_timer = curr->next; /* things may be inserted */ if (curr->kind == TIMER_OBJECT && curr->arg.a_obj == src) { - (void) start_timer(curr->timeout - monstermoves, TIMER_OBJECT, + (void) start_timer(curr->timeout - g.monstermoves, TIMER_OBJECT, curr->func_index, obj_to_any(dest)); } } @@ -2055,7 +2055,7 @@ xchar x, y; short func_index; { long expires = spot_time_expires(x, y, func_index); - return (expires > 0L) ? expires - monstermoves : 0L; + return (expires > 0L) ? expires - g.monstermoves : 0L; } /* Insert timer into the global queue */ diff --git a/src/topten.c b/src/topten.c index 5ef6cc4f1..03a32f094 100644 --- a/src/topten.c +++ b/src/topten.c @@ -366,7 +366,7 @@ int how; Fprintf(rfile, "%cwhile=%s", XLOG_SEP, g.multi_reason ? g.multi_reason : "helpless"); Fprintf(rfile, "%cconduct=0x%lx%cturns=%ld%cachieve=0x%lx", XLOG_SEP, - encodeconduct(), XLOG_SEP, moves, XLOG_SEP, encodeachieve()); + encodeconduct(), XLOG_SEP, g.moves, XLOG_SEP, encodeachieve()); Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld", XLOG_SEP, (long) urealtime.realtime, XLOG_SEP, (long) ubirthday, XLOG_SEP, (long) urealtime.finish_time); diff --git a/src/wizard.c b/src/wizard.c index e2584311c..7d1ecb77f 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -642,7 +642,7 @@ resurrect() if (mtmp->iswiz /* if he has the Amulet, he won't bring it to you */ && !mon_has_amulet(mtmp) - && (elapsed = monstermoves - mtmp->mlstmv) > 0L) { + && (elapsed = g.monstermoves - mtmp->mlstmv) > 0L) { mon_catchup_elapsed_time(mtmp, elapsed); if (elapsed >= LARGEST_INT) elapsed = LARGEST_INT - 1; diff --git a/src/worm.c b/src/worm.c index fad1b05ea..785e73559 100644 --- a/src/worm.c +++ b/src/worm.c @@ -219,9 +219,9 @@ struct monst *worm; seg->nseg = new_seg; /* attach it to the end of the list */ wheads[wnum] = new_seg; /* move the end pointer */ - if (wgrowtime[wnum] <= moves) { + if (wgrowtime[wnum] <= g.moves) { if (!wgrowtime[wnum]) - wgrowtime[wnum] = moves + rnd(5); + wgrowtime[wnum] = g.moves + rnd(5); else wgrowtime[wnum] += rn1(15, 3); worm->mhp += 3; diff --git a/src/worn.c b/src/worn.c index 2a120a554..5632690e1 100644 --- a/src/worn.c +++ b/src/worn.c @@ -741,7 +741,7 @@ clear_bypasses() } for (otmp = invent; otmp; otmp = otmp->nobj) otmp->bypass = 0; - for (otmp = migrating_objs; otmp; otmp = otmp->nobj) + for (otmp = g.migrating_objs; otmp; otmp = otmp->nobj) otmp->bypass = 0; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { if (DEADMONSTER(mtmp)) @@ -762,7 +762,7 @@ clear_bypasses() /* no MCORPSENM(mtmp)==PM_LONG_WORM check here; long worms can't be just created by polymorph and migrating at the same time */ } - /* billobjs and g.mydogs chains don't matter here */ + /* g.billobjs and g.mydogs chains don't matter here */ context.bypasses = FALSE; } diff --git a/src/zap.c b/src/zap.c index ce88ca41d..714db23ef 100644 --- a/src/zap.c +++ b/src/zap.c @@ -2899,7 +2899,7 @@ struct obj *obj; /* wand or spell */ case WAN_POLYMORPH: case SPE_POLYMORPH: del_engr(e); - make_engr_at(x, y, random_engraving(buf), moves, (xchar) 0); + make_engr_at(x, y, random_engraving(buf), g.moves, (xchar) 0); break; case WAN_CANCELLATION: case SPE_CANCELLATION: