do_positionbar();
#endif
- didmove = flags.move;
+ didmove = context.move;
if(didmove) {
/* actual time passed */
youmonst.movement -= NORMAL_SPEED;
do { /* hero can't move this turn loop */
wtcap = encumber_msg();
- flags.mon_moving = TRUE;
+ context.mon_moving = TRUE;
do {
monscanmove = movemon();
if (youmonst.movement > NORMAL_SPEED)
break; /* it's now your turn */
} while (monscanmove);
- flags.mon_moving = FALSE;
+ context.mon_moving = FALSE;
if (!monscanmove && youmonst.movement < NORMAL_SPEED) {
/* both you and the monsters are out of steam this round */
/* once-per-turn things go here */
/********************************/
- if (flags.bypasses) clear_bypasses();
+ if (context.bypasses) clear_bypasses();
if(Glib) glibr();
nh_timeout();
run_regions();
if (u.ublesscnt) u.ublesscnt--;
- if(flags.time && !flags.run)
- flags.botl = 1;
+ if(flags.time && !context.run)
+ context.botl = 1;
/* One possible result of prayer is healing. Whether or
* not you get healed depends on your current hit points.
} else if (Upolyd && youmonst.data->mlet == S_EEL && !is_pool(u.ux,u.uy) && !Is_waterlevel(&u.uz)) {
if (u.mh > 1) {
u.mh--;
- flags.botl = 1;
+ context.botl = 1;
} else if (u.mh < 1)
rehumanize();
} else if (Upolyd && u.mh < u.mhmax) {
rehumanize();
else if (Regeneration ||
(wtcap < MOD_ENCUMBER && !(moves%20))) {
- flags.botl = 1;
+ context.botl = 1;
u.mh++;
}
} else if (u.uhp < u.uhpmax &&
heal = rnd(Con);
if (heal > u.ulevel-9) heal = u.ulevel-9;
}
- flags.botl = 1;
+ context.botl = 1;
u.uhp += heal;
if(u.uhp > u.uhpmax)
u.uhp = u.uhpmax;
} else if (Regeneration ||
(u.ulevel <= 9 &&
!(moves % ((MAXULEV+12) / (u.ulevel+2) + 1)))) {
- flags.botl = 1;
+ context.botl = 1;
u.uhp++;
}
}
|| Energy_regeneration)) {
u.uen += rn1((int)(ACURR(A_WIS) + ACURR(A_INT)) / 15 + 1,1);
if (u.uen > u.uenmax) u.uen = u.uenmax;
- flags.botl = 1;
+ context.botl = 1;
}
if(!u.uinvulnerable) {
/****************************************/
find_ac();
- if(!flags.mv || Blind) {
+ if(!context.mv || Blind) {
/* redo monsters if hallu or wearing a helm of telepathy */
if (Hallucination) { /* update screen randomly */
see_monsters();
if (vision_full_recalc) vision_recalc(0); /* vision! */
}
- if(flags.botl || flags.botlx) bot();
+ if(context.botl || context.botlx) bot();
- flags.move = 1;
+ context.move = 1;
if(multi >= 0 && occupation) {
#if defined(MICRO) || defined(WIN32)
lookaround();
if (!multi) {
/* lookaround may clear multi */
- flags.move = 0;
- if (flags.time) flags.botl = 1;
+ context.move = 0;
+ if (flags.time) context.botl = 1;
continue;
}
- if (flags.mv) {
+ if (context.mv) {
if(multi < COLNO && !--multi)
- flags.travel = flags.mv = flags.run = 0;
+ context.travel = context.mv = context.run = 0;
domove();
} else {
--multi;
}
if (u.utotype) /* change dungeon level */
deferred_goto(); /* after rhack() */
- /* !flags.move here: multiple movement command stopped */
- else if (flags.time && (!flags.move || !flags.mv))
- flags.botl = 1;
+ /* !context.move here: multiple movement command stopped */
+ else if (flags.time && (!context.move || !context.mv))
+ context.botl = 1;
if (vision_full_recalc) vision_recalc(0); /* vision! */
/* when running in non-tport mode, this gets done through domove() */
- if ((!flags.run || flags.runmode == RUN_TPORT) &&
- (multi && (!flags.travel ? !(multi % 7) : !(moves % 7L)))) {
- if (flags.time && flags.run) flags.botl = 1;
+ if ((!context.run || flags.runmode == RUN_TPORT) &&
+ (multi && (!context.travel ? !(multi % 7) : !(moves % 7L)))) {
+ if (flags.time && context.run) context.botl = 1;
display_nhwindow(WIN_MAP, FALSE);
}
}
if (!maybe_finished_meal(TRUE))
You("stop %s.", occtxt);
occupation = 0;
- flags.botl = 1; /* in case u.uhs changed */
+ context.botl = 1; /* in case u.uhs changed */
/* fainting stops your occupation, there's no reason to sync.
sync_hunger();
*/
gameDiskPrompt();
#endif
- flags.ident = 1;
+ context.botlx = 1;
+ context.ident = 1;
+ context.stethoscope_move = -1L;
+ context.warnlevel = 1;
for (i = 0; i < NUMMONS; i++)
mvitals[i].mvflags = mons[i].geno & G_NOCORPSE;
vision_reset(); /* set up internals for level (after mklev) */
check_special_room(FALSE);
- flags.botlx = 1;
/* Move the monster from under you or else
* makedog() will fail when it calls makemon().
use_stethoscope(obj)
register struct obj *obj;
{
- static long last_used_move = -1;
- static short last_used_movement = 0;
- struct monst *mtmp;
+ struct monst *mtmp;
struct rm *lev;
int rx, ry, res;
boolean interference = (u.uswallow && is_whirly(u.ustuck->data) &&
}
if (!getdir((char *)0)) return 0;
- res = (moves == last_used_move) &&
- (youmonst.movement == last_used_movement);
- last_used_move = moves;
- last_used_movement = youmonst.movement;
+ res = (moves == context.stethoscope_move) &&
+ (youmonst.movement == context.stethoscope_movement);
+ context.stethoscope_move = moves;
+ context.stethoscope_movement = youmonst.movement;
#ifdef STEED
if (u.usteed && u.dz > 0) {
else if (!did_prop)
pline("Nothing seems to happen.");
- flags.botl = (did_attr || did_prop);
+ context.botl = (did_attr || did_prop);
#undef PROP_COUNT
#undef ATTR_COUNT
#undef prop2trbl
return;
}
if(!getdir((char *)0)) {
- flags.move = multi = 0;
+ context.move = multi = 0;
return;
}
x = u.ux + u.dx; y = u.uy + u.dy;
You("hit your %s with your bullwhip.", body_part(FOOT));
Sprintf(buf, "killed %sself with %s bullwhip", uhim(), uhis());
losehp(dam, buf, NO_KILLER_PREFIX);
- flags.botl = 1;
+ context.botl = 1;
return 1;
} else if ((Fumbling || Glib) && !rn2(5)) {
if (obj->otyp == WAN_TELEPORTATION &&
affects_objects && level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y);
- if (flags.botl) bot(); /* potion effects */
+ if (context.botl) bot(); /* potion effects */
}
damage = zapyourself(obj, FALSE);
if (damage) {
Sprintf(buf, "killed %sself by breaking a wand", uhim());
losehp(damage, buf, NO_KILLER_PREFIX);
}
- if (flags.botl) bot(); /* blindness */
+ if (context.botl) bot(); /* blindness */
} else if ((mon = m_at(x, y)) != 0) {
(void) bhitm(mon, obj);
- /* if (flags.botl) bot(); */
+ /* if (context.botl) bot(); */
}
if (affects_objects && level.objects[x][y]) {
(void) bhitpile(obj, bhito, x, y);
- if (flags.botl) bot(); /* potion effects */
+ if (context.botl) bot(); /* potion effects */
}
}
}
if (spec_m2(otmp)) {
if (on) {
EWarn_of_mon |= wp_mask;
- flags.warntype |= spec_m2(otmp);
+ context.warntype |= spec_m2(otmp);
} else {
EWarn_of_mon &= ~wp_mask;
- flags.warntype &= ~spec_m2(otmp);
+ context.warntype &= ~spec_m2(otmp);
}
see_monsters();
} else {
You("lose magical energy!");
u.uenmax--;
if (u.uen > 0) u.uen--;
- flags.botl = 1;
+ context.botl = 1;
}
} else {
if (mdef->data == &mons[PM_CLAY_GOLEM])
You("absorb magical energy!");
u.uenmax++;
u.uen++;
- flags.botl = 1;
+ context.botl = 1;
}
}
}
if(Sick) make_sick(0L,(char *)0,FALSE,SICK_ALL);
if(Slimed) Slimed = 0L;
if (Blinded > creamed) make_blinded(creamed, FALSE);
- flags.botl = 1;
+ context.botl = 1;
break;
}
case ENERGY_BOOST: {
if(epboost) {
You_feel("re-energized.");
u.uen += epboost;
- flags.botl = 1;
+ context.botl = 1;
} else
goto nothing_special;
break;
You_feel("%s%s!",
(incr > 1 || incr < -1) ? "very ": "",
(incr > 0) ? plusattr[ndx] : minusattr[ndx]);
- flags.botl = 1;
+ context.botl = 1;
if (moves > 1 && (ndx == A_STR || ndx == A_CON))
(void)encumber_msg();
return TRUE;
{
bot1();
bot2();
- flags.botl = flags.botlx = 0;
+ context.botl = context.botlx = 0;
}
/*botl.c*/
if (See_invisible) enl_msg(You_, "see", "saw", " invisible");
if (Blind_telepat) you_are("telepathic");
if (Warning) you_are("warned");
- if (Warn_of_mon && flags.warntype) {
+ if (Warn_of_mon && context.warntype) {
Sprintf(buf, "aware of the presence of %s",
- (flags.warntype & M2_ORC) ? "orcs" :
- (flags.warntype & M2_DEMON) ? "demons" :
+ (context.warntype & M2_ORC) ? "orcs" :
+ (context.warntype & M2_DEMON) ? "demons" :
something);
you_are(buf);
}
if (program_state.done_hup) end_of_input();
#endif
if (firsttime) {
- flags.nopick = 0;
+ context.nopick = 0;
cmd = parse();
}
if (*cmd == '\033') {
- flags.move = FALSE;
+ context.move = FALSE;
return;
}
#ifdef REDO
#endif
{
nhbell();
- flags.move = FALSE;
+ context.move = FALSE;
return; /* probably we just had an interrupt */
}
if (iflags.num_pad && iflags.num_pad_mode == 1) {
}
/* handle most movement commands */
do_walk = do_rush = prefix_seen = FALSE;
- flags.travel = 0;
+ context.travel = 0;
switch (*cmd) {
case 'g': if (movecmd(cmd[1])) {
- flags.run = 2;
+ context.run = 2;
do_rush = TRUE;
} else
prefix_seen = TRUE;
break;
case '5': if (!iflags.num_pad) break; /* else FALLTHRU */
case 'G': if (movecmd(lowc(cmd[1]))) {
- flags.run = 3;
+ context.run = 3;
do_rush = TRUE;
} else
prefix_seen = TRUE;
* normal movement: attack if 'I', move otherwise
*/
case 'F': if (movecmd(cmd[1])) {
- flags.forcefight = 1;
+ context.forcefight = 1;
do_walk = TRUE;
} else
prefix_seen = TRUE;
break;
case 'm': if (movecmd(cmd[1]) || u.dz) {
- flags.run = 0;
- flags.nopick = 1;
+ context.run = 0;
+ context.nopick = 1;
if (!u.dz) do_walk = TRUE;
else cmd[0] = cmd[1]; /* "m<" or "m>" */
} else
prefix_seen = TRUE;
break;
case 'M': if (movecmd(lowc(cmd[1]))) {
- flags.run = 1;
- flags.nopick = 1;
+ context.run = 1;
+ context.nopick = 1;
do_rush = TRUE;
} else
prefix_seen = TRUE;
break;
case '0': if (!iflags.num_pad) break;
(void)ddoinv(); /* a convenience borrowed from the PC */
- flags.move = FALSE;
+ context.move = FALSE;
multi = 0;
return;
case CMD_CLICKLOOK:
if (iflags.clicklook) {
- flags.move = FALSE;
+ context.move = FALSE;
do_look(2, &clicklook_cc);
}
return;
case CMD_TRAVEL:
if (flags.travelcmd) {
- flags.travel = 1;
- flags.run = 8;
- flags.nopick = 1;
+ context.travel = 1;
+ context.run = 8;
+ context.nopick = 1;
do_rush = TRUE;
break;
}
/*FALLTHRU*/
default: if (movecmd(*cmd)) { /* ordinary movement */
- flags.run = 0; /* only matters here if it was 8 */
+ context.run = 0; /* only matters here if it was 8 */
do_walk = TRUE;
} else if (movecmd(iflags.num_pad ?
unmeta(*cmd) : lowc(*cmd))) {
- flags.run = 1;
+ context.run = 1;
do_rush = TRUE;
} else if (movecmd(unctrl(*cmd))) {
- flags.run = 3;
+ context.run = 3;
do_rush = TRUE;
}
break;
}
if (do_walk) {
- if (multi) flags.mv = TRUE;
+ if (multi) context.mv = TRUE;
domove();
- flags.forcefight = 0;
+ context.forcefight = 0;
return;
} else if (do_rush) {
if (firsttime) {
if (!multi) multi = max(COLNO,ROWNO);
u.last_str_turn = 0;
}
- flags.mv = TRUE;
+ context.mv = TRUE;
domove();
return;
} else if (prefix_seen && cmd[1] == '\033') { /* <prefix><escape> */
res = (*func)(); /* perform the command */
}
if (!res) {
- flags.move = FALSE;
+ context.move = FALSE;
multi = 0;
}
return;
Norep("Unknown command '%s'.", expcmd);
}
/* didn't move */
- flags.move = FALSE;
+ context.move = FALSE;
multi = 0;
return;
}
boolean prezero = FALSE;
multi = 0;
- flags.move = 1;
+ context.move = 1;
flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
if (!iflags.num_pad || (foo = readchar()) == 'n')
#define mk_message(dest) ((dest & 1) ? "" : (char *)0)
#define mk_corpse(dest) ((dest & 2) ? AD_DGST : AD_PHYS)
/* if monsters are moving, one of them caused the destruction */
- if (flags.mon_moving)
+ if (context.mon_moving)
monkilled(etmp->emon, mk_message(dest), mk_corpse(dest));
else /* you caused it */
xkilled(etmp->emon, dest);
number of shots, index of current one, validity check, shoot vs throw */
NEARDATA struct multishot m_shot = { 0, 0, STRANGE_OBJECT, FALSE };
-NEARDATA struct dig_info digging;
-
NEARDATA dungeon dungeons[MAXDUNGEON]; /* ini'ed by init_dungeon() */
NEARDATA s_level *sp_levchn;
NEARDATA stairway upstair = { 0, 0 }, dnstair = { 0, 0 };
dlevel_t level; /* level map */
struct trap *ftrap = (struct trap *)0;
NEARDATA struct monst youmonst = DUMMY;
+NEARDATA struct context_info context = DUMMY;
NEARDATA struct flag flags = DUMMY;
NEARDATA struct instance_flags iflags = DUMMY;
NEARDATA struct you u = DUMMY;
dig()
{
register struct rm *lev;
- register xchar dpx = digging.pos.x, dpy = digging.pos.y;
+ register xchar dpx = context.digging.pos.x, dpy = context.digging.pos.y;
register boolean ispick = uwep && is_pick(uwep);
const char *verb =
(!uwep || is_pick(uwep)) ? "dig into" : "chop through";
/* perhaps a nymph stole your pick-axe while you were busy digging */
/* or perhaps you teleported away */
if (u.uswallow || !uwep || (!ispick && !is_axe(uwep)) ||
- !on_level(&digging.level, &u.uz) ||
- ((digging.down ? (dpx != u.ux || dpy != u.uy)
+ !on_level(&context.digging.level, &u.uz) ||
+ ((context.digging.down ? (dpx != u.ux || dpy != u.uy)
: (distu(dpx,dpy) > 2))))
return(0);
- if (digging.down) {
+ if (context.digging.down) {
if(!dig_check(BY_YOU, TRUE, u.ux, u.uy)) return(0);
- } else { /* !digging.down */
+ } else { /* !context.digging.down */
if (IS_TREE(lev->typ) && !may_dig(dpx,dpy) &&
dig_typ(uwep, dpx, dpy) == DIGTYP_TREE) {
pline("This tree seems to be petrified.");
return(0);
}
- digging.effort += 10 + rn2(5) + abon() +
+ context.digging.effort += 10 + rn2(5) + abon() +
uwep->spe - greatest_erosion(uwep) + u.udaminc;
if (Race_if(PM_DWARF))
- digging.effort *= 2;
- if (digging.down) {
+ context.digging.effort *= 2;
+ if (context.digging.down) {
register struct trap *ttmp;
- if (digging.effort > 250) {
+ if (context.digging.effort > 250) {
(void) dighole(FALSE);
- (void) memset((genericptr_t)&digging, 0, sizeof digging);
+ (void) memset((genericptr_t)&context.digging, 0,
+ sizeof (struct dig_info));
return(0); /* done with digging */
}
- if (digging.effort <= 50 ||
+ if (context.digging.effort <= 50 ||
((ttmp = t_at(dpx,dpy)) != 0 &&
(ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT ||
ttmp->ttyp == TRAPDOOR || ttmp->ttyp == HOLE)))
}
if (dighole(TRUE)) { /* make pit at <u.ux,u.uy> */
- digging.level.dnum = 0;
- digging.level.dlevel = -1;
+ context.digging.level.dnum = 0;
+ context.digging.level.dlevel = -1;
}
return(0);
}
- if (digging.effort > 100) {
+ if (context.digging.effort > 100) {
register const char *digtxt, *dmgtxt = (const char*) 0;
register struct obj *obj;
register boolean shopedge = *in_rooms(dpx, dpy, SHOPBASE);
feel_location(dpx, dpy);
else
newsym(dpx, dpy);
- if(digtxt && !digging.quiet) pline(digtxt); /* after newsym */
+ if(digtxt && !context.digging.quiet) pline(digtxt); /* after newsym */
if(dmgtxt)
pay_for_damage(dmgtxt, FALSE);
newsym(dpx, dpy);
}
cleanup:
- digging.lastdigtime = moves;
- digging.quiet = FALSE;
- digging.level.dnum = 0;
- digging.level.dlevel = -1;
+ context.digging.lastdigtime = moves;
+ context.digging.quiet = FALSE;
+ context.digging.level.dnum = 0;
+ context.digging.level.dlevel = -1;
return(0);
} else { /* not enough effort has been spent yet */
static const char *const d_target[6] = {
holetime()
{
if(occupation != dig || !*u.ushops) return(-1);
- return ((250 - digging.effort) / 20);
+ return ((250 - context.digging.effort) / 20);
}
/* Return typ of liquid to fill a hole with, or ROOM, if no liquid nearby */
Sprintf(buf, "%s own %s", uhis(),
OBJ_NAME(objects[obj->otyp]));
losehp(dam, buf, KILLED_BY);
- flags.botl=1;
+ context.botl=1;
return(1);
} else if(u.dz == 0) {
if(Stunned || (Confusion && !rn2(5))) confdir();
"cutting the tree"
};
did_dig_msg = FALSE;
- digging.quiet = FALSE;
- if (digging.pos.x != rx || digging.pos.y != ry ||
- !on_level(&digging.level, &u.uz) || digging.down) {
+ context.digging.quiet = FALSE;
+ if (context.digging.pos.x != rx ||
+ context.digging.pos.y != ry ||
+ !on_level(&context.digging.level, &u.uz) ||
+ context.digging.down) {
if (flags.autodig &&
- dig_target == DIGTYP_ROCK && !digging.down &&
- digging.pos.x == u.ux &&
- digging.pos.y == u.uy &&
- (moves <= digging.lastdigtime+2 &&
- moves >= digging.lastdigtime)) {
+ dig_target == DIGTYP_ROCK && !context.digging.down &&
+ context.digging.pos.x == u.ux &&
+ context.digging.pos.y == u.uy &&
+ (moves <= context.digging.lastdigtime+2 &&
+ moves >= context.digging.lastdigtime)) {
/* avoid messages if repeated autodigging */
did_dig_msg = TRUE;
- digging.quiet = TRUE;
+ context.digging.quiet = TRUE;
}
- digging.down = digging.chew = FALSE;
- digging.warned = FALSE;
- digging.pos.x = rx;
- digging.pos.y = ry;
- assign_level(&digging.level, &u.uz);
- digging.effort = 0;
- if (!digging.quiet)
+ context.digging.down = context.digging.chew = FALSE;
+ context.digging.warned = FALSE;
+ context.digging.pos.x = rx;
+ context.digging.pos.y = ry;
+ assign_level(&context.digging.level, &u.uz);
+ context.digging.effort = 0;
+ if (!context.digging.quiet)
You("start %s.", d_action[dig_target]);
} else {
- You("%s %s.", digging.chew ? "begin" : "continue",
+ You("%s %s.", context.digging.chew ? "begin" : "continue",
d_action[dig_target]);
- digging.chew = FALSE;
+ context.digging.chew = FALSE;
}
set_occupation(dig, verbing, 0);
}
Yobjnam2(obj, (char *)0), surface(u.ux,u.uy));
u_wipe_engr(3);
} else {
- if (digging.pos.x != u.ux || digging.pos.y != u.uy ||
- !on_level(&digging.level, &u.uz) || !digging.down) {
- digging.chew = FALSE;
- digging.down = TRUE;
- digging.warned = FALSE;
- digging.pos.x = u.ux;
- digging.pos.y = u.uy;
- assign_level(&digging.level, &u.uz);
- digging.effort = 0;
+ if (context.digging.pos.x != u.ux || context.digging.pos.y != u.uy ||
+ !on_level(&context.digging.level, &u.uz) || !context.digging.down) {
+ context.digging.chew = FALSE;
+ context.digging.down = TRUE;
+ context.digging.warned = FALSE;
+ context.digging.pos.x = u.ux;
+ context.digging.pos.y = u.uy;
+ assign_level(&context.digging.level, &u.uz);
+ context.digging.effort = 0;
You("start %s downward.", verbing);
if (*u.ushops) shopdig(0);
} else
}
if (mtmp) {
- if(zap || digging.warned) {
+ if(zap || context.digging.warned) {
verbalize("Halt, vandal! You're under arrest!");
(void) angry_guards(!(flags.soundok));
} else {
else
str = "fountain";
verbalize("Hey, stop damaging that %s!", str);
- digging.warned = TRUE;
+ context.digging.warned = TRUE;
}
if (is_digging())
stop_occupation();
/* overlay with monsters */
see_monsters();
- flags.botlx = 1; /* force a redraw of the bottom line */
+ context.botlx = 1; /* force a redraw of the bottom line */
}
cls()
{
display_nhwindow(WIN_MESSAGE, FALSE); /* flush messages */
- flags.botlx = 1; /* force update of botl window */
+ context.botlx = 1; /* force update of botl window */
clear_nhwindow(WIN_MAP); /* clear physical screen */
clear_glyph_buffer(); /* this is sort of an extra effort, but OK */
display_nhwindow(WIN_MAP, FALSE);
reset_glyph_bbox();
flushing = 0;
- if(flags.botl || flags.botlx) bot();
+ if(context.botl || context.botlx) bot();
}
/* ========================================================================= */
if (obj->oclass != COIN_CLASS || obj == invent) freeinv(obj);
#else
/* Ensure update when we drop gold objects */
- if (obj->oclass == COIN_CLASS) flags.botl = 1;
+ if (obj->oclass == COIN_CLASS) context.botl = 1;
freeinv(obj);
#endif
hitfloor(obj);
if (obj->oclass != COIN_CLASS || obj == invent) freeinv(obj);
#else
/* Ensure update when we drop gold objects */
- if (obj->oclass == COIN_CLASS) flags.botl = 1;
+ if (obj->oclass == COIN_CLASS) context.botl = 1;
freeinv(obj);
#endif
if (!u.uswallow) {
(trap->ttyp != TRAPDOOR && trap->ttyp != HOLE)
|| !Can_fall_thru(&u.uz) || !trap->tseen) {
- if (flags.autodig && !flags.nopick &&
+ if (flags.autodig && !context.nopick &&
uwep && is_pick(uwep)) {
return use_pick_axe2(uwep);
} else {
if(!Wounded_legs) {
ATEMP(A_DEX)--;
- flags.botl = 1;
+ context.botl = 1;
}
if(!Wounded_legs || (HWounded_legs & TIMEOUT))
if(Wounded_legs) {
if (ATEMP(A_DEX) < 0) {
ATEMP(A_DEX)++;
- flags.botl = 1;
+ context.botl = 1;
}
#ifdef STEED
* and the actual enchantment of the hat is irrelevant.
*/
ABON(A_CHA) += (Role_if(PM_WIZARD) ? 1 : -1);
- flags.botl = 1;
+ context.botl = 1;
makeknown(uarmh->otyp);
break;
case HELM_OF_OPPOSITE_ALIGNMENT:
Tobjnam(uarmh, "glow"), hcolor(NH_BLACK));
curse(uarmh);
}
- flags.botl = 1; /* reveal new alignment or INT & WIS */
+ context.botl = 1; /* reveal new alignment or INT & WIS */
if (Hallucination) {
pline("My brain hurts!"); /* Monty Python's Flying Circus */
} else if (uarmh->otyp == DUNCE_CAP) {
case ORCISH_HELM:
break;
case DUNCE_CAP:
- flags.botl = 1;
+ context.botl = 1;
break;
case CORNUTHAUM:
if (!cancelled_don) {
ABON(A_CHA) += (Role_if(PM_WIZARD) ? -1 : 1);
- flags.botl = 1;
+ context.botl = 1;
}
break;
case HELM_OF_TELEPATHY:
case HELM_OF_OPPOSITE_ALIGNMENT:
u.ualign.type = u.ualignbase[A_CURRENT];
u.ublessed = 0; /* lose the other god's protection */
- flags.botl = 1;
+ context.botl = 1;
break;
default: impossible(unknown_type, c_helmet, uarmh->otyp);
}
break;
case GAUNTLETS_OF_POWER:
makeknown(uarmg->otyp);
- flags.botl = 1; /* taken care of in attrib.c */
+ context.botl = 1; /* taken care of in attrib.c */
break;
case GAUNTLETS_OF_DEXTERITY:
adj_abon(uarmg, uarmg->spe);
break;
case GAUNTLETS_OF_POWER:
makeknown(uarmg->otyp);
- flags.botl = 1; /* taken care of in attrib.c */
+ context.botl = 1; /* taken care of in attrib.c */
break;
case GAUNTLETS_OF_DEXTERITY:
if (!cancelled_don) adj_abon(uarmg, -uarmg->spe);
case AMULET_OF_UNCHANGING:
if (Slimed) {
Slimed = 0;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case AMULET_OF_CHANGE:
makeknown(AMULET_OF_CHANGE);
You("are suddenly very %s!", flags.female ? "feminine"
: "masculine");
- flags.botl = 1;
+ context.botl = 1;
} else
/* already polymorphed into single-gender monster; only
changed the character's base sex */
if (ACURR(which) != old_attrib ||
(objects[obj->otyp].oc_name_known &&
old_attrib != 25 && old_attrib != 3)) {
- flags.botl = 1;
+ context.botl = 1;
makeknown(obj->otyp);
obj->known = 1;
update_inventory();
break;
case RIN_PROTECTION:
if (obj->spe || objects[RIN_PROTECTION].oc_name_known) {
- flags.botl = 1;
+ context.botl = 1;
makeknown(RIN_PROTECTION);
obj->known = 1;
update_inventory();
old_attrib = ACURR(which);
ABON(which) -= obj->spe;
if (ACURR(which) != old_attrib) {
- flags.botl = 1;
+ context.botl = 1;
makeknown(obj->otyp);
obj->known = 1;
update_inventory();
case RIN_PROTECTION:
/* might have forgotten it due to amnesia */
if (obj->spe) {
- flags.botl = 1;
+ context.botl = 1;
makeknown(RIN_PROTECTION);
obj->known = 1;
update_inventory();
/* blindness has just been toggled */
if (Blind_telepat || Infravision) see_monsters();
vision_full_recalc = 1; /* recalc vision limits */
- flags.botl = 1;
+ context.botl = 1;
}
}
/* blindness has just been toggled */
if (Blind_telepat || Infravision) see_monsters();
vision_full_recalc = 1; /* recalc vision limits */
- flags.botl = 1;
+ context.botl = 1;
}
}
You("are suddenly overcome with shame and change your mind.");
u.ublessed = 0; /* lose your god's protection */
makeknown(otmp->otyp);
- flags.botl = 1;
+ context.botl = 1;
return 1;
}
if (uac < -128) uac = -128; /* u.uac is an schar */
if(uac != u.uac){
u.uac = uac;
- flags.botl = 1;
+ context.botl = 1;
}
}
makeknown(uarmg->otyp);
ABON(A_DEX) += (delta);
}
- flags.botl = 1;
+ context.botl = 1;
}
if (uarmh && uarmh == otmp && otmp->otyp == HELM_OF_BRILLIANCE) {
if (delta) {
ABON(A_INT) += (delta);
ABON(A_WIS) += (delta);
}
- flags.botl = 1;
+ context.botl = 1;
}
}
mtmp = m_at(x, y);
mdat = mtmp->data;
if (!mtmp->mpeaceful || !canspotmon(mtmp))
- flags.forcefight = TRUE; /* attack even if invisible */
+ context.forcefight = TRUE; /* attack even if invisible */
kick_monster(x, y);
- flags.forcefight = FALSE;
+ context.forcefight = FALSE;
/* see comment in attack_checks() */
if (!DEADMONSTER(mtmp) &&
!canspotmon(mtmp) &&
!glyph_is_invisible(levl[x][y].glyph) &&
!(u.uswallow && mtmp == u.ustuck))
map_invisible(x, y);
- if((Is_airlevel(&u.uz) || Levitation) && flags.move) {
+ if((Is_airlevel(&u.uz) || Levitation) && context.move) {
int range;
range = ((int)youmonst.data->cwt + (weight_cap() + inv_weight()));
if (!getdir((char *)0)) {
if (obj->oclass == COIN_CLASS) {
u.ugold += obj->quan;
- flags.botl = 1;
+ context.botl = 1;
dealloc_obj(obj);
}
return(0);
if(!u.dx && !u.dy && !u.dz) {
#ifndef GOLDOBJ
u.ugold += obj->quan;
- flags.botl = 1;
+ context.botl = 1;
dealloc_obj(obj);
#endif
You("cannot throw gold at yourself.");
};
#define TTSZ SIZE(tintxts)
-static NEARDATA struct {
- struct obj *tin;
- int usedtime, reqtime;
-} tin;
-
-static NEARDATA struct {
- struct obj *piece; /* the thing being eaten, or last thing that
- * was partially eaten, unless that thing was
- * a tin, which uses the tin structure above,
- * in which case this should be 0 */
- /* doeat() initializes these when piece is valid */
- int usedtime, /* turns spent eating */
- reqtime; /* turns required to eat */
- int nmod; /* coded nutrition per turn */
- Bitfield(canchoke,1); /* was satiated at beginning */
-
- /* start_eating() initializes these */
- Bitfield(fullwarn,1); /* have warned about being full */
- Bitfield(eating,1); /* victual currently being eaten */
- Bitfield(doreset,1); /* stop eating at end of turn */
-} victual;
-
static char *eatmbuf = 0; /* set by cpostfx() */
STATIC_PTR
STATIC_OVL void
recalc_wt()
{
- struct obj *piece = victual.piece;
+ struct obj *piece = context.victual.piece;
#ifdef DEBUG
debugpline("Old weight = %d", piece->owt);
debugpline("Used time = %d, Req'd time = %d",
- victual.usedtime, victual.reqtime);
+ context.victual.usedtime, context.victual.reqtime);
#endif
piece->owt = weight(piece);
#ifdef DEBUG
/* we only set a flag here - the actual reset process is done after
* the round is spent eating.
*/
- if(victual.eating && !victual.doreset) {
+ if(context.victual.eating && !context.victual.doreset) {
#ifdef DEBUG
debugpline("reset_eat...");
#endif
- victual.doreset = TRUE;
+ context.victual.doreset = TRUE;
}
return;
}
food_disappears(obj)
register struct obj *obj;
{
- if (obj == victual.piece) victual.piece = (struct obj *)0;
+ if (obj == context.victual.piece) {
+ context.victual.piece = (struct obj *)0;
+ context.victual.o_id = 0;
+ }
if (obj->timed) obj_stop_timers(obj);
}
food_substitution(old_obj, new_obj)
struct obj *old_obj, *new_obj;
{
- if (old_obj == victual.piece) victual.piece = new_obj;
- if (old_obj == tin.tin) tin.tin = new_obj;
+ if (old_obj == context.victual.piece) {
+ context.victual.piece = new_obj;
+ context.victual.o_id = new_obj->o_id;
+ }
+ if (old_obj == context.tin.tin) context.tin.tin = new_obj;
}
STATIC_OVL void
#ifdef DEBUG
debugpline("do_reset_eat...");
#endif
- if (victual.piece) {
- victual.piece = touchfood(victual.piece);
+ if (context.victual.piece) {
+ context.victual.o_id = 0;
+ context.victual.piece = touchfood(context.victual.piece);
recalc_wt();
}
- victual.fullwarn = victual.eating = victual.doreset = FALSE;
+ context.victual.fullwarn = context.victual.eating = context.victual.doreset = FALSE;
/* Do not set canchoke to FALSE; if we continue eating the same object
* we need to know if canchoke was set when they started eating it the
* previous time. And if we don't continue eating the same object
int
eatfood() /* called each move during eating process */
{
- if(!victual.piece ||
- (!carried(victual.piece) && !obj_here(victual.piece, u.ux, u.uy))) {
+ if(!context.victual.piece ||
+ (!carried(context.victual.piece) &&
+ !obj_here(context.victual.piece, u.ux, u.uy))) {
/* maybe it was stolen? */
do_reset_eat();
return(0);
}
- if(!victual.eating) return(0);
+ if(!context.victual.eating) return(0);
- if(++victual.usedtime <= victual.reqtime) {
+ if(++context.victual.usedtime <= context.victual.reqtime) {
if(bite()) return(0);
return(1); /* still busy */
} else { /* done */
done_eating(message)
boolean message;
{
- victual.piece->in_use = TRUE;
+ context.victual.piece->in_use = TRUE;
occupation = 0; /* do this early, so newuhs() knows we're done */
newuhs(FALSE);
if (nomovemsg) {
if (message) pline(nomovemsg);
nomovemsg = 0;
} else if (message)
- You("finish eating %s.", food_xname(victual.piece, TRUE));
+ You("finish eating %s.", food_xname(context.victual.piece, TRUE));
- if(victual.piece->otyp == CORPSE)
- cpostfx(victual.piece->corpsenm);
+ if(context.victual.piece->otyp == CORPSE)
+ cpostfx(context.victual.piece->corpsenm);
else
- fpostfx(victual.piece);
+ fpostfx(context.victual.piece);
- if (carried(victual.piece)) useup(victual.piece);
- else useupf(victual.piece, 1L);
- victual.piece = (struct obj *) 0;
- victual.fullwarn = victual.eating = victual.doreset = FALSE;
+ if (carried(context.victual.piece)) useup(context.victual.piece);
+ else useupf(context.victual.piece, 1L);
+ context.victual.piece = (struct obj *) 0;
+ context.victual.o_id = 0;
+ context.victual.fullwarn = context.victual.eating = context.victual.doreset = FALSE;
}
STATIC_OVL void
killer = killer_buf;
You("turn to stone.");
done(STONING);
- if (victual.piece)
- victual.eating = FALSE;
+ if (context.victual.piece)
+ context.victual.eating = FALSE;
return; /* lifesaved */
}
}
killer_format = NO_KILLER_PREFIX;
done(DIED);
/* It so happens that since we know these monsters */
- /* cannot appear in tins, victual.piece will always */
+ /* cannot appear in tins, context.victual.piece will always */
/* be what we want, which is not generally true. */
- if (revive_corpse(victual.piece))
- victual.piece = (struct obj *)0;
+ if (revive_corpse(context.victual.piece))
+ context.victual.piece = (struct obj *)0;
return;
}
case PM_GREEN_SLIME:
youmonst.data != &mons[PM_GREEN_SLIME]) {
You("don't feel very well.");
Slimed = 10L;
- flags.botl = 1;
+ context.botl = 1;
}
/* Fall through */
default:
}
if (old_uen != u.uen) {
You_feel("a mild buzz.");
- flags.botl = 1;
+ context.botl = 1;
}
}
break;
case PM_NURSE:
if (Upolyd) u.mh = u.mhmax;
else u.uhp = u.uhpmax;
- flags.botl = 1;
+ context.botl = 1;
break;
case PM_STALKER:
if(!Invis) {
const char *what;
int which;
- if(!carried(tin.tin) && !obj_here(tin.tin, u.ux, u.uy))
+ if(!carried(context.tin.tin) && !obj_here(context.tin.tin, u.ux, u.uy))
/* perhaps it was stolen? */
return(0); /* %% probably we should use tinoid */
- if(tin.usedtime++ >= 50) {
+ if(context.tin.usedtime++ >= 50) {
You("give up your attempt to open the tin.");
return(0);
}
- if(tin.usedtime < tin.reqtime)
+ if(context.tin.usedtime < context.tin.reqtime)
return(1); /* still busy */
- if(tin.tin->otrapped ||
- (tin.tin->cursed && tin.tin->spe != -1 && !rn2(8))) {
+ if(context.tin.tin->otrapped ||
+ (context.tin.tin->cursed && context.tin.tin->spe != -1 && !rn2(8))) {
b_trapped("tin", 0);
goto use_me;
}
You("succeed in opening the tin.");
- if(tin.tin->spe != 1) {
- if (tin.tin->corpsenm == NON_PM) {
+ if(context.tin.tin->spe != 1) {
+ if (context.tin.tin->corpsenm == NON_PM) {
pline("It turns out to be empty.");
- tin.tin->dknown = tin.tin->known = TRUE;
+ context.tin.tin->dknown = context.tin.tin->known = TRUE;
goto use_me;
}
- r = tin.tin->cursed ? ROTTEN_TIN : /* always rotten if cursed */
- (tin.tin->spe == -1) ? HOMEMADE_TIN : /* player made it */
+ r = context.tin.tin->cursed ? ROTTEN_TIN : /* always rotten if cursed */
+ (context.tin.tin->spe == -1) ? HOMEMADE_TIN : /* player made it */
rn2(TTSZ-1); /* else take your pick */
- if (r == ROTTEN_TIN && (tin.tin->corpsenm == PM_LIZARD ||
- tin.tin->corpsenm == PM_LICHEN))
+ if (r == ROTTEN_TIN && (context.tin.tin->corpsenm == PM_LIZARD ||
+ context.tin.tin->corpsenm == PM_LICHEN))
r = HOMEMADE_TIN; /* lizards don't rot */
- else if (tin.tin->spe == -1 && !tin.tin->blessed && !rn2(7))
+ else if (context.tin.tin->spe == -1 && !context.tin.tin->blessed && !rn2(7))
r = ROTTEN_TIN; /* some homemade tins go bad */
which = 0; /* 0=>plural, 1=>as-is, 2=>"the" prefix */
if (Hallucination) {
what = rndmonnam();
} else {
- what = mons[tin.tin->corpsenm].mname;
- if (mons[tin.tin->corpsenm].geno & G_UNIQ)
- which = type_is_pname(&mons[tin.tin->corpsenm]) ? 1 : 2;
+ what = mons[context.tin.tin->corpsenm].mname;
+ if (mons[context.tin.tin->corpsenm].geno & G_UNIQ)
+ which = type_is_pname(&mons[context.tin.tin->corpsenm]) ? 1 : 2;
}
if (which == 0) what = makeplural(what);
pline("It smells like %s%s.", (which == 2) ? "the " : "", what);
if (yn("Eat it?") == 'n') {
- if (!Hallucination) tin.tin->dknown = tin.tin->known = TRUE;
+ if (!Hallucination) context.tin.tin->dknown = context.tin.tin->known = TRUE;
if (flags.verbose) You("discard the open tin.");
goto use_me;
}
/* in case stop_occupation() was called on previous meal */
- victual.piece = (struct obj *)0;
- victual.fullwarn = victual.eating = victual.doreset = FALSE;
+ context.victual.piece = (struct obj *)0;
+ context.victual.fullwarn = context.victual.eating = context.victual.doreset = FALSE;
You("consume %s %s.", tintxts[r].txt,
- mons[tin.tin->corpsenm].mname);
+ mons[context.tin.tin->corpsenm].mname);
/* KMH, conduct */
u.uconduct.food++;
- if (!vegan(&mons[tin.tin->corpsenm]))
+ if (!vegan(&mons[context.tin.tin->corpsenm]))
u.uconduct.unvegan++;
- if (!vegetarian(&mons[tin.tin->corpsenm]))
+ if (!vegetarian(&mons[context.tin.tin->corpsenm]))
violated_vegetarian();
- tin.tin->dknown = tin.tin->known = TRUE;
- cprefx(tin.tin->corpsenm); cpostfx(tin.tin->corpsenm);
+ context.tin.tin->dknown = context.tin.tin->known = TRUE;
+ cprefx(context.tin.tin->corpsenm); cpostfx(context.tin.tin->corpsenm);
- if(((!carried(tin.tin) && costly_spot(tin.tin->ox, tin.tin->oy) &&
- !tin.tin->no_charge)
- || tin.tin->unpaid)) {
+ if(((!carried(context.tin.tin) && costly_spot(context.tin.tin->ox, context.tin.tin->oy) &&
+ !context.tin.tin->no_charge)
+ || context.tin.tin->unpaid)) {
verbalize("You open it, you bought it!");
/* charge for one at pre-eating cost */
- if(tin.tin->quan > 1L) tin.tin = splitobj(tin.tin, 1L);
- bill_dummy_object(tin.tin);
+ if(context.tin.tin->quan > 1L) context.tin.tin = splitobj(context.tin.tin, 1L);
+ bill_dummy_object(context.tin.tin);
}
/* check for vomiting added by GAN 01/16/87 */
makeplural(body_part(FINGER)));
}
} else {
- if (tin.tin->cursed)
+ if (context.tin.tin->cursed)
pline("It contains some decaying%s%s substance.",
Blind ? "" : " ", Blind ? "" : hcolor(NH_GREEN));
else
pline("It contains spinach.");
if (yn("Eat it?") == 'n') {
- if (!Hallucination && !tin.tin->cursed)
- tin.tin->dknown = tin.tin->known = TRUE;
+ if (!Hallucination && !context.tin.tin->cursed)
+ context.tin.tin->dknown = context.tin.tin->known = TRUE;
if (flags.verbose)
You("discard the open tin.");
goto use_me;
}
- tin.tin->dknown = tin.tin->known = TRUE;
- if(((!carried(tin.tin) && costly_spot(tin.tin->ox, tin.tin->oy) &&
- !tin.tin->no_charge)
- || tin.tin->unpaid)) {
+ context.tin.tin->dknown = context.tin.tin->known = TRUE;
+ if(((!carried(context.tin.tin) && costly_spot(context.tin.tin->ox, context.tin.tin->oy) &&
+ !context.tin.tin->no_charge)
+ || context.tin.tin->unpaid)) {
verbalize("You open it, you bought it!");
/* charge for one at pre-eating cost */
- if(tin.tin->quan > 1L) tin.tin = splitobj(tin.tin, 1L);
- bill_dummy_object(tin.tin);
+ if(context.tin.tin->quan > 1L) context.tin.tin = splitobj(context.tin.tin, 1L);
+ bill_dummy_object(context.tin.tin);
}
- if (!tin.tin->cursed)
+ if (!context.tin.tin->cursed)
pline("This makes you feel like %s!",
Hallucination ? "Swee'pea" : "Popeye");
lesshungry(600);
- gainstr(tin.tin, 0);
+ gainstr(context.tin.tin, 0);
u.uconduct.food++;
}
use_me:
- if (carried(tin.tin)) useup(tin.tin);
- else useupf(tin.tin, 1L);
- tin.tin = (struct obj *) 0;
+ if (carried(context.tin.tin)) useup(context.tin.tin);
+ else useupf(context.tin.tin, 1L);
+ context.tin.tin = (struct obj *) 0;
return(0);
}
}
tmp = rn1(1 + 500/((int)(ACURR(A_DEX) + ACURRSTR)), 10);
}
- tin.reqtime = tmp;
- tin.usedtime = 0;
- tin.tin = otmp;
+ context.tin.reqtime = tmp;
+ context.tin.usedtime = 0;
+ context.tin.tin = otmp;
set_occupation(opentin, "opening the tin", 0);
return;
}
}
/* delay is weight dependent */
- victual.reqtime = 3 + (mons[mnum].cwt >> 6);
+ context.victual.reqtime = 3 + (mons[mnum].cwt >> 6);
if (!tp && mnum != PM_LIZARD && mnum != PM_LICHEN &&
(otmp->orotten || !rn2(7))) {
register struct obj *otmp;
{
#ifdef DEBUG
- debugpline("start_eating: %lx (victual = %lx)", otmp, victual.piece);
- debugpline("reqtime = %d", victual.reqtime);
+ debugpline("start_eating: %lx (victual = %lx)", otmp, context.victual.piece);
+ debugpline("reqtime = %d", context.victual.reqtime);
debugpline("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
- debugpline("nmod = %d", victual.nmod);
+ debugpline("nmod = %d", context.victual.nmod);
debugpline("oeaten = %d", otmp->oeaten);
#endif
- victual.fullwarn = victual.doreset = FALSE;
- victual.eating = TRUE;
+ context.victual.fullwarn = context.victual.doreset = FALSE;
+ context.victual.eating = TRUE;
if (otmp->otyp == CORPSE) {
- cprefx(victual.piece->corpsenm);
- if (!victual.piece || !victual.eating) {
+ cprefx(context.victual.piece->corpsenm);
+ if (!context.victual.piece || !context.victual.eating) {
/* rider revived, or died and lifesaved */
return;
}
if (bite()) return;
- if (++victual.usedtime >= victual.reqtime) {
+ if (++context.victual.usedtime >= context.victual.reqtime) {
/* print "finish eating" message if they just resumed -dlc */
- done_eating(victual.reqtime > 1 ? TRUE : FALSE);
+ done_eating(context.victual.reqtime > 1 ? TRUE : FALSE);
return;
}
/* not cannibalism, but we use similar criteria
for deciding whether to be sickened by this meal */
if (rn2(2) && !CANNIBAL_ALLOWED())
- make_vomiting((long)rn1(victual.reqtime, 14), FALSE);
+ make_vomiting((long)rn1(context.victual.reqtime, 14), FALSE);
}
break;
case MEATBALL:
/* break; */
case CLOVE_OF_GARLIC:
if (is_undead(youmonst.data)) {
- make_vomiting((long)rn1(victual.reqtime, 5), FALSE);
+ make_vomiting((long)rn1(context.victual.reqtime, 5), FALSE);
break;
}
/* Fall through otherwise */
accessory_has_effect(otmp);
HProtection |= FROMOUTSIDE;
u.ublessed += otmp->spe;
- flags.botl = 1;
+ context.botl = 1;
break;
case RIN_FREE_ACTION:
/* Give sleep resistance instead */
change_sex();
You("are suddenly very %s!",
flags.female ? "feminine" : "masculine");
- flags.botl = 1;
+ context.botl = 1;
break;
case AMULET_OF_STRANGULATION: /* bad idea! */
/* no message--this gives no permanent effect */
STATIC_OVL void
eatspecial() /* called after eating non-food */
{
- register struct obj *otmp = victual.piece;
+ register struct obj *otmp = context.victual.piece;
/* lesshungry wants an occupation to handle choke messages correctly */
set_occupation(eatfood, "eating non-food", 0);
- lesshungry(victual.nmod);
+ lesshungry(context.victual.nmod);
occupation = 0;
- victual.piece = (struct obj *)0;
- victual.eating = 0;
+ context.victual.piece = (struct obj *)0;
+ context.victual.eating = 0;
if (otmp->oclass == COIN_CLASS) {
#ifdef GOLDOBJ
if (carried(otmp))
}
if (otmp->oclass != FOOD_CLASS) {
int material;
- victual.reqtime = 1;
- victual.piece = otmp;
+ context.victual.reqtime = 1;
+ context.victual.piece = otmp;
/* Don't split it, we don't need to if it's 1 move */
- victual.usedtime = 0;
- victual.canchoke = (u.uhs == SATIATED);
+ context.victual.usedtime = 0;
+ context.victual.canchoke = (u.uhs == SATIATED);
/* Note: gold weighs 1 pt. for each 1000 pieces (see */
/* pickup.c) so gold and non-gold is consistent. */
if (otmp->oclass == COIN_CLASS)
basenutrit = weight(otmp);
/* oc_nutrition is usually weight anyway */
else basenutrit = objects[otmp->otyp].oc_nutrition;
- victual.nmod = basenutrit;
- victual.eating = TRUE; /* needed for lesshungry() */
+ context.victual.nmod = basenutrit;
+ context.victual.eating = TRUE; /* needed for lesshungry() */
material = objects[otmp->otyp].oc_material;
if (material == LEATHER ||
return 1;
}
- if(otmp == victual.piece) {
+ if(otmp == context.victual.piece) {
/* If they weren't able to choke, they don't suddenly become able to
* choke just because they were interrupted. On the other hand, if
* they were able to choke before, if they lost food it's possible
* they shouldn't be able to choke now.
*/
- if (u.uhs != SATIATED) victual.canchoke = FALSE;
- victual.piece = touchfood(otmp);
+ if (u.uhs != SATIATED) context.victual.canchoke = FALSE;
+ context.victual.piece = touchfood(otmp);
You("resume your meal.");
- start_eating(victual.piece);
+ start_eating(context.victual.piece);
return(1);
}
/* KMH, conduct */
u.uconduct.food++;
- victual.piece = otmp = touchfood(otmp);
- victual.usedtime = 0;
+ context.victual.piece = otmp = touchfood(otmp);
+ context.victual.usedtime = 0;
/* Now we need to calculate delay and nutritional info.
* The base nutrition calculated here and in eatcorpse() accounts
int tmp = eatcorpse(otmp);
if (tmp == 2) {
/* used up */
- victual.piece = (struct obj *)0;
+ context.victual.piece = (struct obj *)0;
return(1);
} else if (tmp)
dont_start = TRUE;
break;
}
- victual.reqtime = objects[otmp->otyp].oc_delay;
+ context.victual.reqtime = objects[otmp->otyp].oc_delay;
if (otmp->otyp != FORTUNE_COOKIE &&
(otmp->cursed ||
(((monstermoves - otmp->age) > (int) otmp->blessed ? 50:30) &&
else basenutrit = objects[otmp->otyp].oc_nutrition;
#ifdef DEBUG
- debugpline("before rounddiv: victual.reqtime == %d", victual.reqtime);
+ debugpline("before rounddiv: context.victual.reqtime == %d", context.victual.reqtime);
debugpline("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit);
#endif
- victual.reqtime = (basenutrit == 0 ? 0 :
- rounddiv(victual.reqtime * (long)otmp->oeaten, basenutrit));
+ context.victual.reqtime = (basenutrit == 0 ? 0 :
+ rounddiv(context.victual.reqtime * (long)otmp->oeaten, basenutrit));
#ifdef DEBUG
- debugpline("after rounddiv: victual.reqtime == %d", victual.reqtime);
+ debugpline("after rounddiv: context.victual.reqtime == %d", context.victual.reqtime);
#endif
/* calculate the modulo value (nutrit. units per round eating)
* note: this isn't exact - you actually lose a little nutrition
* TODO: add in a "remainder" value to be given at the end of the
* meal.
*/
- if (victual.reqtime == 0 || otmp->oeaten == 0)
+ if (context.victual.reqtime == 0 || otmp->oeaten == 0)
/* possible if most has been eaten before */
- victual.nmod = 0;
- else if ((int)otmp->oeaten >= victual.reqtime)
- victual.nmod = -((int)otmp->oeaten / victual.reqtime);
+ context.victual.nmod = 0;
+ else if ((int)otmp->oeaten >= context.victual.reqtime)
+ context.victual.nmod = -((int)otmp->oeaten / context.victual.reqtime);
else
- victual.nmod = victual.reqtime % otmp->oeaten;
- victual.canchoke = (u.uhs == SATIATED);
+ context.victual.nmod = context.victual.reqtime % otmp->oeaten;
+ context.victual.canchoke = (u.uhs == SATIATED);
if (!dont_start) start_eating(otmp);
return(1);
STATIC_OVL int
bite()
{
- if(victual.canchoke && u.uhunger >= 2000) {
- choke(victual.piece);
+ if(context.victual.canchoke && u.uhunger >= 2000) {
+ choke(context.victual.piece);
return 1;
}
- if (victual.doreset) {
+ if (context.victual.doreset) {
do_reset_eat();
return 0;
}
force_save_hs = TRUE;
- if(victual.nmod < 0) {
- lesshungry(-victual.nmod);
- consume_oeaten(victual.piece, victual.nmod); /* -= -nmod */
- } else if(victual.nmod > 0 && (victual.usedtime % victual.nmod)) {
+ if(context.victual.nmod < 0) {
+ lesshungry(-context.victual.nmod);
+ consume_oeaten(context.victual.piece, context.victual.nmod); /* -= -nmod */
+ } else if(context.victual.nmod > 0 && (context.victual.usedtime % context.victual.nmod)) {
lesshungry(1);
- consume_oeaten(victual.piece, -1); /* -= 1 */
+ consume_oeaten(context.victual.piece, -1); /* -= 1 */
}
force_save_hs = FALSE;
recalc_wt();
#endif
u.uhunger += num;
if(u.uhunger >= 2000) {
- if (!iseating || victual.canchoke) {
+ if (!iseating || context.victual.canchoke) {
if (iseating) {
- choke(victual.piece);
+ choke(context.victual.piece);
reset_eat();
} else
- choke(occupation == opentin ? tin.tin : (struct obj *)0);
+ choke(occupation == opentin ? context.tin.tin : (struct obj *)0);
/* no reset_eat() */
}
} else {
* warns when you're about to choke.
*/
if (u.uhunger >= 1500) {
- if (!victual.eating || (victual.eating && !victual.fullwarn)) {
+ if (!context.victual.eating || (context.victual.eating && !context.victual.fullwarn)) {
pline("You're having a hard time getting all of it down.");
nomovemsg = "You're finally finished.";
- if (!victual.eating)
+ if (!context.victual.eating)
multi = -2;
else {
- victual.fullwarn = TRUE;
- if (victual.canchoke && victual.reqtime > 1) {
+ context.victual.fullwarn = TRUE;
+ if (context.victual.canchoke && context.victual.reqtime > 1) {
/* a one-gulp food will not survive a stop */
if (yn_function("Stop eating?",ynchars,'y')=='y') {
reset_eat();
if(u.uhs > FAINTING)
u.uhs = FAINTING;
stop_occupation();
- flags.botl = 1;
+ context.botl = 1;
return 0;
}
} else
if(u.uhunger < -(int)(200 + 20*ACURR(A_CON))) {
u.uhs = STARVED;
- flags.botl = 1;
+ context.botl = 1;
bot();
You("die from starvation.");
killer_format = KILLED_BY;
break;
}
u.uhs = newhs;
- flags.botl = 1;
+ context.botl = 1;
bot();
if ((Upolyd ? u.mh : u.uhp) < 1) {
You("die from hunger and exhaustion.");
* victual handling mechanism from scratch using a less complex
* model. Alternatively, this routine could call done_eating()
* or food_disappears() but its callers would need revisions to
- * cope with victual.piece unexpectedly going away.
+ * cope with context.victual.piece unexpectedly going away.
*
* Multi-turn eating operates by setting the food's oeaten field
* to its full nutritional value and then running a counter which
}
if (obj->oeaten == 0) {
- if (obj == victual.piece) /* always true unless wishing... */
- victual.reqtime = victual.usedtime; /* no bites left */
+ if (obj == context.victual.piece) /* always true unless wishing... */
+ context.victual.reqtime = context.victual.usedtime; /* no bites left */
obj->oeaten = 1; /* smallest possible positive value */
}
}
boolean stopping;
{
/* in case consume_oeaten() has decided that the food is all gone */
- if (occupation == eatfood && victual.usedtime >= victual.reqtime) {
+ if (occupation == eatfood && context.victual.usedtime >= context.victual.reqtime) {
if (stopping) occupation = 0; /* for do_reset_eat */
- (void) eatfood(); /* calls done_eating() to use up victual.piece */
+ (void) eatfood(); /* calls done_eating() to use up context.victual.piece */
return TRUE;
}
return FALSE;
}
if (how == CHOKING) init_uhunger();
nomovemsg = "You survived that attempt on your life.";
- flags.move = 0;
+ context.move = 0;
if(multi > 0) multi = 0; else multi = -1;
if(u.utrap && u.utraptype == TT_LAVA) u.utrap = 0;
- flags.botl = 1;
+ context.botl = 1;
u.ugrave_arise = NON_PM;
HUnchanging = 0L;
curs_on_u();
et = ep->engr_txt;
You("%s: \"%s\".",
(Blind) ? "feel the words" : "read", et);
- if(flags.run > 1) nomul(0);
+ if(context.run > 1) nomul(0);
}
}
}
#ifdef SCORE_ON_BOTL
|| flags.showscore
#endif
- ) flags.botl = 1;
+ ) context.botl = 1;
if (u.urexp >= (Role_if(PM_WIZARD) ? 1000 : 2000))
flags.beginner = 0;
}
if (u.uexp > 0)
u.uexp = newuexp(u.ulevel) - 1;
- flags.botl = 1;
+ context.botl = 1;
}
/*
adjabil(u.ulevel - 1, u.ulevel); /* give new intrinsics */
reset_rndmonst(NON_PM); /* new monster selection */
}
- flags.botl = 1;
+ context.botl = 1;
}
/* compute a random amount of experience points suitable for the hero's
}
if (mtmp->mhp <= 0) {
/* KMH -- Don't blame the player for pets killing gas spores */
- if (!flags.mon_moving) killed(mtmp);
+ if (!context.mon_moving) killed(mtmp);
else monkilled(mtmp, "", (int)adtyp);
- } else if (!flags.mon_moving) setmangry(mtmp);
+ } else if (!context.mon_moving) setmangry(mtmp);
}
/* Do your injury last */
u.mh -= damu;
else
u.uhp -= damu;
- flags.botl = 1;
+ context.botl = 1;
}
if (u.uhp <= 0 || (Upolyd && u.mh <= 0)) {
for (ii = 0; ii < A_MAX; ii++)
if (ABASE(ii) < AMAX(ii)) {
ABASE(ii) = AMAX(ii);
- flags.botl = 1;
+ context.botl = 1;
}
/* gain ability, blessed if "natural" luck is high */
i = rn2(A_MAX); /* start at a random attribute */
struct obj *boulder = sobj_at(BOULDER,x,y);
const char *digtxt = (char *)0, *dmgtxt = (char *)0;
- if (digging.down) /* not continuing previous dig (w/ pick-axe) */
- (void) memset((genericptr_t)&digging, 0, sizeof digging);
+ if (context.digging.down) /* not continuing previous dig (w/ pick-axe) */
+ (void) memset((genericptr_t)&context.digging, 0, sizeof(struct dig_info));
if (!boulder && IS_ROCK(lev->typ) && !may_dig(x,y)) {
You("hurt your teeth on the %s.",
IS_TREE(lev->typ) ? "tree" : "hard stone");
nomul(0);
return 1;
- } else if (digging.pos.x != x || digging.pos.y != y ||
- !on_level(&digging.level, &u.uz)) {
- digging.down = FALSE;
- digging.chew = TRUE;
- digging.warned = FALSE;
- digging.pos.x = x;
- digging.pos.y = y;
- assign_level(&digging.level, &u.uz);
+ } else if (context.digging.pos.x != x || context.digging.pos.y != y ||
+ !on_level(&context.digging.level, &u.uz)) {
+ context.digging.down = FALSE;
+ context.digging.chew = TRUE;
+ context.digging.warned = FALSE;
+ context.digging.pos.x = x;
+ context.digging.pos.y = y;
+ assign_level(&context.digging.level, &u.uz);
/* solid rock takes more work & time to dig through */
- digging.effort =
+ context.digging.effort =
(IS_ROCK(lev->typ) && !IS_TREE(lev->typ) ? 30 : 60) + u.udaminc;
You("start chewing %s %s.",
(boulder || IS_TREE(lev->typ)) ? "on a" : "a hole in the",
IS_TREE(lev->typ) ? "tree" : IS_ROCK(lev->typ) ? "rock" : "door");
watch_dig((struct monst *)0, x, y, FALSE);
return 1;
- } else if ((digging.effort += (30 + u.udaminc)) <= 100) {
+ } else if ((context.digging.effort += (30 + u.udaminc)) <= 100) {
if (flags.verbose)
You("%s chewing on the %s.",
- digging.chew ? "continue" : "begin",
+ context.digging.chew ? "continue" : "begin",
boulder ? "boulder" :
IS_TREE(lev->typ) ? "tree" :
IS_ROCK(lev->typ) ? "rock" : "door");
- digging.chew = TRUE;
+ context.digging.chew = TRUE;
watch_dig((struct monst *)0, x, y, FALSE);
return 1;
}
if (IS_ROCK(lev->typ) || closed_door(x,y) || sobj_at(BOULDER,x,y)) {
block_point(x,y); /* delobj will unblock the point */
/* reset dig state */
- (void) memset((genericptr_t)&digging, 0, sizeof digging);
+ (void) memset((genericptr_t)&context.digging, 0, sizeof(struct dig_info));
return 1;
}
newsym(x, y);
if (digtxt) You(digtxt); /* after newsym */
if (dmgtxt) pay_for_damage(dmgtxt, FALSE);
- (void) memset((genericptr_t)&digging, 0, sizeof digging);
+ (void) memset((genericptr_t)&context.digging, 0, sizeof(struct dig_info));
return 0;
}
} else if (tunnels(youmonst.data) && !needspick(youmonst.data)) {
/* Eat the rock. */
if (mode == DO_MOVE && still_chewing(x,y)) return FALSE;
- } else if (flags.autodig && !flags.run && !flags.nopick &&
+ } else if (flags.autodig && !context.run && !context.nopick &&
uwep && is_pick(uwep)) {
/* MRKR: Automatic digging when wielding the appropriate tool */
if (mode == DO_MOVE)
}
}
/* pick a path that does not require crossing a trap */
- if (flags.run == 8 && mode != DO_MOVE) {
+ if (context.run == 8 && mode != DO_MOVE) {
struct trap* t = t_at(x, y);
if (t && t->tseen) return FALSE;
}
if (sobj_at(BOULDER,x,y) && (In_sokoban(&u.uz) || !Passes_walls)) {
- if (!(Blind || Hallucination) && (flags.run >= 2) && mode != TEST_TRAV)
+ if (!(Blind || Hallucination) && (context.run >= 2) && mode != TEST_TRAV)
return FALSE;
if (mode == DO_MOVE) {
/* tunneling monsters will chew before pushing */
if (x == u.tx && y == u.ty) {
nomul(0);
/* reset run so domove run checks work */
- flags.run = 8;
+ context.run = 8;
iflags.travelcc.x = iflags.travelcc.y = -1;
}
return TRUE;
u_wipe_engr(rnd(5));
- if (flags.travel)
+ if (context.travel)
if (!findtravelpath(FALSE))
(void) findtravelpath(TRUE);
(Blind && !Levitation && !Flying &&
!is_clinger(youmonst.data) &&
(is_pool(x, y) || is_lava(x, y)) && levl[x][y].seenv)) {
- if(flags.run >= 2) {
+ if(context.run >= 2) {
nomul(0);
- flags.move = 0;
+ context.move = 0;
return;
} else
nomul(0);
if (mtmp) {
/* Don't attack if you're running, and can see it */
/* We should never get here if forcefight */
- if (flags.run &&
+ if (context.run &&
((!Blind && mon_visible(mtmp) &&
((mtmp->m_ap_type != M_AP_FURNITURE &&
mtmp->m_ap_type != M_AP_OBJECT) ||
Protection_from_shape_changers)) ||
sensemon(mtmp))) {
nomul(0);
- flags.move = 0;
+ context.move = 0;
return;
}
}
* invisible monster--then, we fall through to attack() and
* attack_check(), which still wastes a turn, but prints a
* different message and makes the player remember the monster. */
- if(flags.nopick &&
+ if(context.nopick &&
(canspotmon(mtmp) || glyph_is_invisible(levl[x][y].glyph))){
if(mtmp->m_ap_type && !Protection_from_shape_changers
&& !sensemon(mtmp))
You("move right into %s.", mon_nam(mtmp));
return;
}
- if(flags.forcefight || !mtmp->mundetected || sensemon(mtmp) ||
+ if(context.forcefight || !mtmp->mundetected || sensemon(mtmp) ||
((hides_under(mtmp->data) || mtmp->data->mlet == S_EEL) &&
!is_safepet(mtmp))){
gethungry();
}
/* specifying 'F' with no monster wastes a turn */
- if (flags.forcefight ||
+ if (context.forcefight ||
/* remembered an 'I' && didn't use a move command */
- (glyph_is_invisible(levl[x][y].glyph) && !flags.nopick)) {
+ (glyph_is_invisible(levl[x][y].glyph) && !context.nopick)) {
boolean expl = (Upolyd && attacktype(youmonst.data, AT_EXPL));
char buf[BUFSZ];
Sprintf(buf,"a vacant spot on the %s", surface(x,y));
}
if (!test_move(u.ux, u.uy, x-u.ux, y-u.uy, DO_MOVE)) {
- flags.move = 0;
+ context.move = 0;
nomul(0);
return;
}
}
reset_occupations();
- if (flags.run) {
- if ( flags.run < 8 )
+ if (context.run) {
+ if ( context.run < 8 )
if (IS_DOOR(tmpr->typ) || IS_ROCK(tmpr->typ) ||
IS_FURNITURE(tmpr->typ))
nomul(0);
nomovemsg = "";
}
- if (flags.run && flags.runmode != RUN_TPORT) {
+ 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.time) flags.botl = 1;
+ if (flags.time) context.botl = 1;
curs_on_u();
delay_output();
if (flags.runmode == RUN_CRAWL) {
return;
}
- if(Blind || flags.run == 0) return;
+ if(Blind || context.run == 0) return;
for(x = u.ux-1; x <= u.ux+1; x++) for(y = u.uy-1; y <= u.uy+1; y++) {
if(!isok(x,y)) continue;
mtmp->m_ap_type != M_AP_FURNITURE &&
mtmp->m_ap_type != M_AP_OBJECT &&
(!mtmp->minvis || See_invisible) && !mtmp->mundetected) {
- if((flags.run != 1 && !mtmp->mtame)
+ if((context.run != 1 && !mtmp->mtame)
|| (x == u.ux+u.dx && y == u.uy+u.dy))
goto stop;
}
(mtmp->mappearance == S_hcdoor ||
mtmp->mappearance == S_vcdoor))) {
if(x != u.ux && y != u.uy) continue;
- if(flags.run != 1) goto stop;
+ if(context.run != 1) goto stop;
goto bcorr;
} else if (levl[x][y].typ == CORR) {
bcorr:
if(levl[u.ux][u.uy].typ != ROOM) {
- if(flags.run == 1 || flags.run == 3 || flags.run == 8) {
+ if(context.run == 1 || context.run == 3 || context.run == 8) {
i = dist2(x,y,u.ux+u.dx,u.uy+u.dy);
if(i > 2) continue;
if(corrct == 1 && dist2(x,y,x0,y0) != 1)
}
continue;
} else if ((trap = t_at(x,y)) && trap->tseen) {
- if(flags.run == 1) goto bcorr; /* if you must */
+ if(context.run == 1) goto bcorr; /* if you must */
if(x == u.ux+u.dx && y == u.uy+u.dy) goto stop;
continue;
} else if (is_pool(x,y) || is_lava(x,y)) {
goto stop;
continue;
} else { /* e.g. objects or trap or stairs */
- if(flags.run == 1) goto bcorr;
- if(flags.run == 8) continue;
+ if(context.run == 1) goto bcorr;
+ if(context.run == 8) continue;
if(mtmp) continue; /* d */
if(((x == u.ux - u.dx) && (y != u.uy + u.dy)) ||
((y == u.uy - u.dy) && (x != u.ux + u.dx)))
return;
} /* end for loops */
- if(corrct > 1 && flags.run == 2) goto stop;
- if((flags.run == 1 || flags.run == 3 || flags.run == 8) &&
+ if(corrct > 1 && context.run == 2) goto stop;
+ if((context.run == 1 || context.run == 3 || context.run == 8) &&
!noturn && !m0 && i0 && (corrct == 1 || (corrct == 2 && i0 == 1)))
{
/* make sure that we do not turn too far */
u.uinvulnerable = FALSE; /* Kludge to avoid ctrl-C bug -dlc */
u.usleep = 0;
multi = nval;
- flags.travel = flags.mv = flags.run = 0;
+ context.travel = context.mv = context.run = 0;
}
/* called when a non-movement, multi-turn action has completed */
if (Upolyd) {
u.mh -= n;
if (u.mhmax < u.mh) u.mhmax = u.mh;
- flags.botl = 1;
+ context.botl = 1;
if (u.mh < 1)
rehumanize();
else if (n > 0 && u.mh*10 < u.mhmax && Unchanging)
u.uhp -= n;
if(u.uhp > u.uhpmax)
u.uhpmax = u.uhp; /* perhaps n was negative */
- flags.botl = 1;
+ context.botl = 1;
if(u.uhp < 1) {
killer_format = k_format;
killer = knam; /* the thing that killed you */
#ifndef GOLDOBJ
u.ugold += obj->quan;
#else
- flags.botl = 1;
+ context.botl = 1;
#endif
} else if (obj->otyp == AMULET_OF_YENDOR) {
if (u.uhave.amulet) impossible("already have amulet?");
u.ugold -= obj->quan;
obj->in_use = FALSE;
#endif
- flags.botl = 1;
+ context.botl = 1;
return;
} else if (obj->otyp == AMULET_OF_YENDOR) {
if (!u.uhave.amulet) impossible("don't have amulet?");
curse(obj);
} else if (confers_luck(obj)) {
set_moreluck();
- flags.botl = 1;
+ context.botl = 1;
} else if (obj->otyp == FIGURINE && obj->timed) {
(void) stop_timer(FIG_TRANSFORM, (genericptr_t) obj);
}
u.ugold -= q;
otmp->quan = q;
otmp->owt = weight(otmp);
- flags.botl = 1;
+ context.botl = 1;
return(otmp);
}
#endif
}
}
#ifdef GOLDOBJ
- flags.botl = 1; /* May have changed the amount of money */
+ context.botl = 1; /* May have changed the amount of money */
#endif
#ifdef REDO
savech(ilet);
You("have no gold.");
allowgold = 2;
#else
- flags.botl = 1;
+ context.botl = 1;
#endif
} else if (sym == 'a') {
allflag = TRUE;
xlock.box = 0;
}
}
- flags.move = 0;
+ context.move = 0;
xlock.chance = ch;
xlock.picktyp = picktyp;
xlock.usedtime = 0;
*m2 = *mon; /* copy condition of old monster */
m2->nmon = fmon;
fmon = m2;
- m2->m_id = flags.ident++;
- if (!m2->m_id) m2->m_id = flags.ident++; /* ident overflowed */
+ m2->m_id = context.ident++;
+ if (!m2->m_id) m2->m_id = context.ident++; /* ident overflowed */
m2->mx = mm.x;
m2->my = mm.y;
(void)memset((genericptr_t)mtmp->mextra, 0, xlth);
mtmp->nmon = fmon;
fmon = mtmp;
- mtmp->m_id = flags.ident++;
- if (!mtmp->m_id) mtmp->m_id = flags.ident++; /* ident overflowed */
+ mtmp->m_id = context.ident++;
+ if (!mtmp->m_id) mtmp->m_id = context.ident++; /* ident overflowed */
set_mon_data(mtmp, ptr, 0);
if (mtmp->data->msound == MS_LEADER)
quest_status.leader_m_id = mtmp->m_id;
}
} else if (mndx == PM_WIZARD_OF_YENDOR) {
mtmp->iswiz = TRUE;
- flags.no_of_wizards++;
- if (flags.no_of_wizards == 1 && Is_earthlevel(&u.uz))
+ context.no_of_wizards++;
+ if (context.no_of_wizards == 1 && Is_earthlevel(&u.uz))
mitem = SPE_DIG;
} else if (mndx == PM_DJINNI) {
- flags.djinni_count++;
+ context.djinni_count++;
} else if (mndx == PM_GHOST) {
- flags.ghost_count++;
+ context.ghost_count++;
if (!(mmflags & MM_NONAME))
mtmp = christen_monst(mtmp, rndghostname());
} else if (mndx == PM_VLAD_THE_IMPALER) {
dmg = 0;
break;
case MGC_CLONE_WIZ:
- if (mtmp->iswiz && flags.no_of_wizards == 1) {
+ if (mtmp->iswiz && context.no_of_wizards == 1) {
pline("Double Trouble...");
clonewiz();
dmg = 0;
if (!mcouldseeu && (spellnum == MGC_SUMMON_MONS ||
(!mtmp->iswiz && spellnum == MGC_CLONE_WIZ)))
return TRUE;
- if ((!mtmp->iswiz || flags.no_of_wizards > 1)
+ if ((!mtmp->iswiz || context.no_of_wizards > 1)
&& spellnum == MGC_CLONE_WIZ)
return TRUE;
} else if (adtyp == AD_CLRC) {
default: /* no attack */
break;
}
- if(flags.botl) bot();
+ if(context.botl) 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 (dmg < 1) dmg = 1;
if (dmg > 1) exercise(A_STR, FALSE);
u.mh -= dmg;
- flags.botl = 1;
+ context.botl = 1;
dmg = 0;
if(cloneu())
You("divide as %s hits you!",mon_nam(mtmp));
if (!rn2(3)) exercise(A_STR, TRUE);
if (!rn2(3)) exercise(A_CON, TRUE);
if (Sick) make_sick(0L, (char *) 0, FALSE, SICK_ALL);
- flags.botl = 1;
+ context.botl = 1;
if (goaway) {
mongone(mtmp);
return 2;
} else if (!Slimed) {
You("don't feel very well.");
Slimed = 10L;
- flags.botl = 1;
+ context.botl = 1;
killer_format = KILLED_BY_AN;
delayed_killer = mtmp->data->mname;
} else
*hpmax_p = lowerlimit;
else /* unlikely... */
; /* already at or below minimum threshold; do nothing */
- flags.botl = 1;
+ context.botl = 1;
}
mdamageu(mtmp, dmg);
register struct monst *mtmp;
register int n;
{
- flags.botl = 1;
+ context.botl = 1;
if (Upolyd) {
u.mh -= n;
if (u.mh < 1) rehumanize();
case 1: You("are down in the dumps.");
(void) adjattrib(A_CON, -1, TRUE);
exercise(A_CON, FALSE);
- flags.botl = 1;
+ context.botl = 1;
break;
case 2: Your("senses are dulled.");
(void) adjattrib(A_WIS, -1, TRUE);
exercise(A_WIS, FALSE);
- flags.botl = 1;
+ context.botl = 1;
break;
case 3:
if (!resists_drli(&youmonst)) {
case 1: You_feel("good enough to do it again.");
(void) adjattrib(A_CON, 1, TRUE);
exercise(A_CON, TRUE);
- flags.botl = 1;
+ context.botl = 1;
break;
case 2: You("will always remember %s...", noit_mon_nam(mon));
(void) adjattrib(A_WIS, 1, TRUE);
exercise(A_WIS, TRUE);
- flags.botl = 1;
+ context.botl = 1;
break;
case 3: pline("That was a very educational experience.");
pluslvl(FALSE);
u.uhp = u.uhpmax;
if (Upolyd) u.mh = u.mhmax;
exercise(A_STR, TRUE);
- flags.botl = 1;
+ context.botl = 1;
break;
}
}
noit_Monnam(mon), cost, currency(cost));
u.ugold -= cost;
mon->mgold += cost;
- flags.botl = 1;
+ context.botl = 1;
}
#else
long cost;
pline("%s takes %ld %s for services rendered!",
noit_Monnam(mon), cost, currency(cost));
money2mon(mon, cost);
- flags.botl = 1;
+ context.botl = 1;
}
#endif
}
mon->mhpmax = u.mhmax;
mon->mhp = u.mh / 2;
u.mh -= mon->mhp;
- flags.botl = 1;
+ context.botl = 1;
return(mon);
}
}
(void) money2mon(mtmp, offer);
#endif
- flags.botl = 1;
+ context.botl = 1;
return(offer);
}
panic("splitobj"); /* can't split containers */
otmp = newobj(obj->oxlth + obj->onamelth);
*otmp = *obj; /* copies whole structure */
- otmp->o_id = flags.ident++;
- if (!otmp->o_id) otmp->o_id = flags.ident++; /* ident overflowed */
+ otmp->o_id = context.ident++;
+ if (!otmp->o_id) otmp->o_id = context.ident++; /* ident overflowed */
otmp->timed = 0; /* not timed, yet */
otmp->lamplit = 0; /* ditto */
otmp->owornmask = 0L; /* new object isn't worn */
dummy = newobj(otmp->oxlth + otmp->onamelth);
*dummy = *otmp;
dummy->where = OBJ_FREE;
- dummy->o_id = flags.ident++;
- if (!dummy->o_id) dummy->o_id = flags.ident++; /* ident overflowed */
+ dummy->o_id = context.ident++;
+ if (!dummy->o_id) dummy->o_id = context.ident++; /* ident overflowed */
dummy->timed = 0;
if (otmp->oxlth)
(void)memcpy((genericptr_t)dummy->oextra,
otmp = newobj(0);
*otmp = zeroobj;
otmp->age = monstermoves;
- otmp->o_id = flags.ident++;
- if (!otmp->o_id) otmp->o_id = flags.ident++; /* ident overflowed */
+ otmp->o_id = context.ident++;
+ if (!otmp->o_id) otmp->o_id = context.ident++; /* ident overflowed */
otmp->quan = 1L;
otmp->oclass = let;
otmp->otyp = otyp;
}
break;
case AMULET_CLASS:
- if (otmp->otyp == AMULET_OF_YENDOR) flags.made_amulet = TRUE;
+ if (otmp->otyp == AMULET_OF_YENDOR) context.made_amulet = TRUE;
if(rn2(10) && (otmp->otyp == AMULET_OF_STRANGULATION ||
otmp->otyp == AMULET_OF_CHANGE ||
otmp->otyp == AMULET_OF_RESTFUL_SLEEP)) {
/* if polymorph or undead turning has killed this monster,
prevent the same attack beam from hitting its corpse */
- if (flags.bypasses) bypass_obj(obj);
+ if (context.bypasses) bypass_obj(obj);
if (mtmp->mnamelth)
obj = oname(obj, NAME(mtmp));
#ifdef STEED
if (mon == u.usteed) {
- if (u.ugallop && flags.mv) {
+ if (u.ugallop && context.mv) {
/* average movement is 1.50 times normal */
mmove = ((rn2(2) ? 4 : 5) * mmove) / 3;
}
}
/* attacking your own quest leader will anger his or her guardians */
- if (!flags.mon_moving && /* should always be the case here */
+ if (!context.mon_moving && /* should always be the case here */
mtmp->data == &mons[quest_info(MS_LEADER)]) {
struct monst *mon;
struct permonst *q_guardian = &mons[quest_info(MS_GUARDIAN)];
mtmp->meating = 0; /* assume there's no salvagable food left */
setmangry(mtmp);
if(mtmp->m_ap_type) seemimic(mtmp);
- else if (flags.forcefight && !flags.mon_moving && mtmp->mundetected) {
+ else if (context.forcefight && !context.mon_moving && mtmp->mundetected) {
mtmp->mundetected = 0;
newsym(mtmp->mx, mtmp->my);
}
mon_break_armor(mtmp, polyspot);
if (!(mtmp->misc_worn_check & W_ARMG))
mselftouch(mtmp, "No longer petrify-resistant, ",
- !flags.mon_moving);
+ !context.mon_moving);
m_dowear(mtmp, FALSE);
/* This ought to re-test can_carry() on each item in the inventory
}
} else if (is_digging()) {
/* chewing, wand/spell of digging are checked elsewhere */
- watch_dig(mtmp, digging.pos.x, digging.pos.y, FALSE);
+ watch_dig(mtmp, context.digging.pos.x, context.digging.pos.y, FALSE);
}
}
}
(nonliving(mtmp->data) || !canspotmon(mtmp))
? "destroyed" : "killed");
/* don't blame hero for unknown rolling boulder trap */
- if (!flags.mon_moving &&
+ if (!context.mon_moving &&
(otmp->otyp != BOULDER || range >= 0 || !otmp->otrapped))
xkilled(mtmp,0);
else mondied(mtmp);
potion_descr = OBJ_DESCR(objects[obj->otyp]);
if (potion_descr && !strcmp(potion_descr, "milky")) {
- if ( flags.ghost_count < MAXMONNO &&
- !rn2(POTION_OCCUPANT_CHANCE(flags.ghost_count))) {
+ if ( context.ghost_count < MAXMONNO &&
+ !rn2(POTION_OCCUPANT_CHANCE(context.ghost_count))) {
if (!enexto(&cc, mon->mx, mon->my, &mons[PM_GHOST])) return 0;
mquaffmsg(mon, obj);
m_useup(mon, obj);
}
}
if (potion_descr && !strcmp(potion_descr, "smoky") &&
- flags.djinni_count < MAXMONNO &&
- !rn2(POTION_OCCUPANT_CHANCE(flags.djinni_count))) {
+ context.djinni_count < MAXMONNO &&
+ !rn2(POTION_OCCUPANT_CHANCE(context.djinni_count))) {
if (!enexto(&cc, mon->mx, mon->my, &mons[PM_DJINNI])) return 0;
mquaffmsg(mon, obj);
m_useup(mon, obj);
if (from_user)
pline("%d gold piece%s.", cnt, plur(cnt));
u.ugold += cnt;
- flags.botl=1;
+ context.botl=1;
return (&zeroobj);
#else
otmp = mksobj(GOLD_PIECE, FALSE, FALSE);
otmp->quan = cnt;
otmp->owt = weight(otmp);
- flags.botl=1;
+ context.botl=1;
return (otmp);
#endif
}
warnsyms[i] = def_warnsyms[i].sym;
iflags.bouldersym = 0;
iflags.travelcc.x = iflags.travelcc.y = -1;
- flags.warnlevel = 1;
- flags.warntype = 0L;
/* assert( sizeof flags.inv_order == sizeof def_inv_order ); */
(void)memcpy((genericptr_t)flags.inv_order,
|| (boolopt[i].addr) == &flags.showscore
#endif
)
- flags.botl = TRUE;
+ context.botl = TRUE;
else if ((boolopt[i].addr) == &flags.invlet_constant) {
if (flags.invlet_constant) reassign();
/* If there are objects here, take a look. */
if (ct) {
- if (flags.run) nomul(0);
+ if (context.run) nomul(0);
flush_screen(1);
(void) look_here(ct, picked_some);
} else {
if (!u.uswallow) {
struct trap *ttmp = t_at(u.ux, u.uy);
/* no auto-pick if no-pick move, nothing there, or in a pool */
- if (autopickup && (flags.nopick || !OBJ_AT(u.ux, u.uy) ||
+ if (autopickup && (context.nopick || !OBJ_AT(u.ux, u.uy) ||
(is_pool(u.ux, u.uy) && !Underwater) || is_lava(u.ux, u.uy))) {
read_engr_at(u.ux, u.uy);
return (0);
/* no pickup if levitating & not on air or water level */
if (!can_reach_floor()) {
- if ((multi && !flags.run) || (autopickup && !flags.pickup))
+ if ((multi && !context.run) || (autopickup && !flags.pickup))
read_engr_at(u.ux, u.uy);
return (0);
}
return(0);
}
}
- /* multi && !flags.run means they are in the middle of some other
+ /* multi && !context.run means they are in the middle of some other
* action, or possibly paralyzed, sleeping, etc.... and they just
* teleported onto the object. They shouldn't pick it up.
*/
- if ((multi && !flags.run) || (autopickup && !flags.pickup)) {
+ if ((multi && !context.run) || (autopickup && !flags.pickup)) {
check_here(FALSE);
return (0);
}
}
/* if there's anything here, stop running */
- if (OBJ_AT(u.ux,u.uy) && flags.run && flags.run != 8 && !flags.nopick) nomul(0);
+ if (OBJ_AT(u.ux,u.uy) && context.run && context.run != 8 && !context.nopick) nomul(0);
}
add_valid_menu_class(0); /* reset */
else
obj->quan -= count;
}
- flags.botl = 1;
- if (flags.run) nomul(0);
+ context.botl = 1;
+ if (context.run) nomul(0);
return 1;
#endif
} else if (obj->otyp == CORPSE) {
#ifdef GOLDOBJ
/* Whats left of the special case for gold :-) */
- if (obj->oclass == COIN_CLASS) flags.botl = 1;
+ if (obj->oclass == COIN_CLASS) context.botl = 1;
#endif
if (obj->quan != count && obj->otyp != LOADSTONE)
obj = splitobj(obj, count);
newcap == 4 ? "can barely" : "can't even");
break;
}
- flags.botl = 1;
+ context.botl = 1;
} else if(oldcap > newcap) {
switch(newcap) {
case 0: Your("movements are now unencumbered.");
stagger(youmonst.data, "stagger"));
break;
}
- flags.botl = 1;
+ context.botl = 1;
}
oldcap = newcap;
Your("body transforms, but there is still slime on you.");
Slimed = 10L;
}
- flags.botl = 1;
+ context.botl = 1;
see_monsters();
(void) encumber_msg();
}
mntmp == PM_SALAMANDER || mntmp == PM_FLAMING_SPHERE) {
pline_The("slime burns away!");
Slimed = 0L;
- flags.botl = 1;
+ context.botl = 1;
} else if (mntmp == PM_GREEN_SLIME) {
/* do it silently */
Slimed = 0L;
- flags.botl = 1;
+ context.botl = 1;
}
}
if (nohands(youmonst.data)) Glib = 0;
You("orient yourself on the web.");
u.utrap = 0;
}
- flags.botl = 1;
+ context.botl = 1;
vision_full_recalc = 1;
see_monsters();
exercise(A_CON, FALSE);
if (!uarmg) selftouch("No longer petrify-resistant, you");
nomul(0);
- flags.botl = 1;
+ context.botl = 1;
vision_full_recalc = 1;
(void) encumber_msg();
}
return(0);
}
u.uen -= 15;
- flags.botl = 1;
+ context.botl = 1;
if (!getdir((char *)0)) return(0);
return(0);
}
u.uen -= 10;
- flags.botl = 1;
+ context.botl = 1;
You("call upon your brethren for help!");
exercise(A_WIS, TRUE);
return(0);
}
u.uen -= 15;
- flags.botl = 1;
+ context.botl = 1;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
if (DEADMONSTER(mtmp)) continue;
return(0);
}
u.uen -= 10;
- flags.botl = 1;
+ context.botl = 1;
You("concentrate.");
pline("A wave of psychic energy pours out.");
if (heal && (u.mh < u.mhmax)) {
u.mh += heal;
if (u.mh > u.mhmax) u.mh = u.mhmax;
- flags.botl = 1;
+ context.botl = 1;
pline("Strangely, you feel better than before.");
exercise(A_STR, TRUE);
}
You_feel("less %s now.",
Hallucination ? "trippy" : "confused");
}
- if ((xtime && !old) || (!xtime && old)) flags.botl = TRUE;
+ if ((xtime && !old) || (!xtime && old)) context.botl = TRUE;
set_itimeout(&HConfusion, xtime);
}
You("%s...", stagger(youmonst.data, "stagger"));
}
}
- if ((!xtime && old) || (xtime && !old)) flags.botl = TRUE;
+ if ((!xtime && old) || (xtime && !old)) context.botl = TRUE;
set_itimeout(&HStun, xtime);
}
}
set_itimeout(&Sick, xtime);
u.usick_type |= type;
- flags.botl = TRUE;
+ context.botl = TRUE;
} else if (old && (type & u.usick_type)) {
/* was sick, now not */
u.usick_type &= ~type;
if (talk) pline("What a relief!");
Sick = 0L; /* set_itimeout(&Sick, 0L) */
}
- flags.botl = TRUE;
+ context.botl = TRUE;
}
if (Sick) {
set_itimeout(&Blinded, xtime);
if (u_could_see ^ can_see_now) { /* one or the other but not both */
- flags.botl = 1;
+ context.botl = 1;
vision_full_recalc = 1; /* blindness just got toggled */
if (Blind_telepat || Infravision) see_monsters();
}
(eg. Qt windowport's equipped items display) */
update_inventory();
- flags.botl = 1;
+ context.botl = 1;
if (talk) pline(message, verb);
}
}
potion_descr = OBJ_DESCR(objects[otmp->otyp]);
if (potion_descr) {
if (!strcmp(potion_descr, "milky") &&
- flags.ghost_count < MAXMONNO &&
- !rn2(POTION_OCCUPANT_CHANCE(flags.ghost_count))) {
+ context.ghost_count < MAXMONNO &&
+ !rn2(POTION_OCCUPANT_CHANCE(context.ghost_count))) {
ghost_from_bottle();
useup(otmp);
return(1);
} else if (!strcmp(potion_descr, "smoky") &&
- flags.djinni_count < MAXMONNO &&
- !rn2(POTION_OCCUPANT_CHANCE(flags.djinni_count))) {
+ context.djinni_count < MAXMONNO &&
+ !rn2(POTION_OCCUPANT_CHANCE(context.djinni_count))) {
djinni_from_bottle(otmp);
useup(otmp);
return(1);
if (i == A_STR && u.uhs >= 3) --lim; /* WEAK */
if (ABASE(i) < lim) {
ABASE(i) = lim;
- flags.botl = 1;
+ context.botl = 1;
/* only first found if not blessed */
if (!otmp->blessed) break;
}
u.uen += (otmp->cursed) ? -num : num;
if(u.uenmax <= 0) u.uenmax = 0;
if(u.uen <= 0) u.uen = 0;
- flags.botl = 1;
+ context.botl = 1;
exercise(A_WIS, TRUE);
}
break;
}
if(cureblind) make_blinded(0L,TRUE);
if(curesick) make_sick(0L, (char *) 0, TRUE, SICK_ALL);
- flags.botl = 1;
+ context.botl = 1;
return;
}
ABASE(i)++;
/* only first found if not blessed */
isdone = !(obj->blessed);
- flags.botl = 1;
+ context.botl = 1;
}
if(++i >= A_MAX) i = 0;
}
}
break;
case POT_FULL_HEALING:
- if (Upolyd && u.mh < u.mhmax) u.mh++, flags.botl = 1;
- if (u.uhp < u.uhpmax) u.uhp++, flags.botl = 1;
+ if (Upolyd && u.mh < u.mhmax) u.mh++, context.botl = 1;
+ if (u.uhp < u.uhpmax) u.uhp++, context.botl = 1;
/*FALL THROUGH*/
case POT_EXTRA_HEALING:
- if (Upolyd && u.mh < u.mhmax) u.mh++, flags.botl = 1;
- if (u.uhp < u.uhpmax) u.uhp++, flags.botl = 1;
+ if (Upolyd && u.mh < u.mhmax) u.mh++, context.botl = 1;
+ if (u.uhp < u.uhpmax) u.uhp++, context.botl = 1;
/*FALL THROUGH*/
case POT_HEALING:
- if (Upolyd && u.mh < u.mhmax) u.mh++, flags.botl = 1;
- if (u.uhp < u.uhpmax) u.uhp++, flags.botl = 1;
+ if (Upolyd && u.mh < u.mhmax) u.mh++, context.botl = 1;
+ if (u.uhp < u.uhpmax) u.uhp++, context.botl = 1;
exercise(A_CON, TRUE);
break;
case POT_SICKNESS:
} else {
if (u.uhp <= 5) u.uhp = 1; else u.uhp -= 5;
}
- flags.botl = 1;
+ context.botl = 1;
exercise(A_CON, FALSE);
}
break;
if (mtmp2) {
mtmp2->mhpmax = u.mhmax / 2;
u.mhmax -= mtmp2->mhpmax;
- flags.botl = 1;
+ context.botl = 1;
You("multiply%s!", reason);
}
} else {
case TROUBLE_STONED:
You_feel("more limber.");
Stoned = 0;
- flags.botl = 1;
+ context.botl = 1;
delayed_killer = 0;
break;
case TROUBLE_SLIMED:
pline_The("slime disappears.");
Slimed = 0;
- flags.botl = 1;
+ context.botl = 1;
delayed_killer = 0;
break;
case TROUBLE_STRANGLED:
}
You("can breathe again.");
Strangled = 0;
- flags.botl = 1;
+ context.botl = 1;
break;
case TROUBLE_LAVA:
You("are back on solid ground.");
case TROUBLE_HUNGRY:
Your("%s feels content.", body_part(STOMACH));
init_uhunger();
- flags.botl = 1;
+ context.botl = 1;
break;
case TROUBLE_SICK:
You_feel("better.");
if (u.uhpmax < u.ulevel * 5 + 11) u.uhpmax += rnd(5);
if (u.uhpmax <= 5) u.uhpmax = 5+1;
u.uhp = u.uhpmax;
- flags.botl = 1;
+ context.botl = 1;
break;
case TROUBLE_COLLAPSING:
ABASE(A_STR) = AMAX(A_STR);
- flags.botl = 1;
+ context.botl = 1;
break;
case TROUBLE_STUCK_IN_WALL:
Your("surroundings change.");
for(i=0; i<A_MAX; i++) {
if(ABASE(i) < AMAX(i)) {
ABASE(i) = AMAX(i);
- flags.botl = 1;
+ context.botl = 1;
}
}
(void) encumber_msg();
if (u.uhunger < 900) init_uhunger();
if (u.uluck < 0) u.uluck = 0;
make_blinded(0L,TRUE);
- flags.botl = 1;
+ context.botl = 1;
break;
case 4: {
register struct obj *otmp;
else
u.ualign.type = u.ualignbase[A_CURRENT] = altaralign;
u.ublessed = 0;
- flags.botl = 1;
+ context.botl = 1;
You("have a sudden sense of a new direction.");
/* Beware, Conversion is costly */
else
u.ugold = 1L;
priest->mgold -= u.ugold;
- flags.botl = 1;
+ context.botl = 1;
#else
if(!money_cnt(invent)) {
if(coaligned && !strayed) {
else
u.uen = (u.uenmax += d(5,4));
}
- flags.botl = 1;
+ context.botl = 1;
break;
}
known = TRUE;
tmprect.hy--;
}
ff->ttl = ttl;
- if (!in_mklev && !flags.mon_moving)
+ if (!in_mklev && !context.mon_moving)
set_heros_fault(ff); /* assume player has created it */
/* ff->can_enter_f = enter_force_field; */
/* ff->can_leave_f = enter_force_field; */
tmprect.hy--;
}
cloud->ttl = rn1(3,4);
- if (!in_mklev && !flags.mon_moving)
+ if (!in_mklev && !context.mon_moving)
set_heros_fault(cloud); /* assume player has created it */
cloud->inside_f = INSIDE_GAS_CLOUD;
cloud->expire_f = EXPIRE_GAS_CLOUD;
mread(fd, (genericptr_t) otmp,
(unsigned) xl + sizeof(struct obj));
if (ghostly) {
- unsigned nid = flags.ident++;
+ unsigned nid = context.ident++;
add_id_mapping(otmp->o_id, nid);
otmp->o_id = nid;
}
otmp3->ocontainer = otmp;
}
if (otmp->bypass) otmp->bypass = 0;
-
+ if (!ghostly) {
+ /* fix the pointers */
+ if (context.victual.o_id == otmp->o_id)
+ context.victual.piece = otmp;
+ if (context.tin.o_id == otmp->o_id)
+ context.tin.tin = otmp;
+ }
otmp2 = otmp;
}
if(first && otmp2->nobj){
else mtmp2->nmon = mtmp;
mread(fd, (genericptr_t) mtmp, (unsigned) xl + sizeof(struct monst));
if (ghostly) {
- unsigned nid = flags.ident++;
+ unsigned nid = context.ident++;
add_id_mapping(mtmp->m_id, nid);
mtmp->m_id = nid;
}
#endif
return FALSE;
}
-
+ mread(fd, (genericptr_t) &context, sizeof(struct context_info));
mread(fd, (genericptr_t) &flags, sizeof(struct flag));
- flags.bypasses = 0; /* never use the saved value of bypasses */
if (remember_discover) discover = remember_discover;
role_init(); /* Reset the initial role, race, gender, and alignment */
#else
money2mon(oracl, (long)u_pay);
#endif
- flags.botl = 1;
+ context.botl = 1;
add_xpts = 0; /* first oracle of each type gives experience points */
if (u_pay == minor_cost) {
outrumor(1, BY_ORACLE);
#endif
uid = getuid();
bwrite(fd, (genericptr_t) &uid, sizeof uid);
+ bwrite(fd, (genericptr_t) &context, sizeof(struct context_info));
bwrite(fd, (genericptr_t) &flags, sizeof(struct flag));
#ifndef GOLDOBJ
if (u.ugold) {
if (Has_contents(otmp))
saveobjchn(fd,otmp->cobj,mode);
if (release_data(mode)) {
- if (otmp->oclass == FOOD_CLASS) food_disappears(otmp);
+/* if (otmp->oclass == FOOD_CLASS) food_disappears(otmp); */
+ if (otmp == context.victual.piece) {
+ /* Store the o_id of the victual if mismatched */
+ if (context.victual.o_id != otmp->o_id)
+ context.victual.o_id = otmp->o_id;
+ }
+ if (otmp == context.tin.tin) {
+ /* Store the o_id of your tin */
+ if (context.tin.o_id != otmp->o_id)
+ context.tin.o_id = otmp->o_id;
+ }
if (otmp->oclass == SPBOOK_CLASS) book_disappears(otmp);
otmp->where = OBJ_FREE; /* set to free so dealloc will work */
otmp->timed = 0; /* not timed any more */
remove_worn_item(ygold, FALSE); /* quiver */
freeinv(ygold);
add_to_minv(mon, ygold);
- flags.botl = 1;
+ context.botl = 1;
return amount;
}
dropy(mongold);
} else {
addinv(mongold);
- flags.botl = 1;
+ context.botl = 1;
}
}
if (balance > 0) money2mon(shkp, balance);
else if (balance < 0) money2u(shkp, -balance);
#endif
- flags.botl = 1;
+ context.botl = 1;
if(robbed) {
robbed -= tmp;
if(robbed < 0) robbed = 0L;
eshkp->debit = 0L;
eshkp->loan = 0L;
You("pay that debt.");
- flags.botl = 1;
+ context.botl = 1;
} else {
dtmp -= eshkp->credit;
eshkp->credit = 0L;
eshkp->loan = 0L;
pline("That debt is partially offset by your credit.");
You("pay the remainder.");
- flags.botl = 1;
+ context.botl = 1;
}
paid = TRUE;
}
if (eshkp->robbed < 0L) eshkp->robbed = 0L;
if (umoney > 0) money2mon(shkp, umoney);
#endif
- flags.botl = 1;
+ context.botl = 1;
pline("%s %s all your possessions.",
shkname(shkp), takes);
taken = TRUE;
#else
money2mon(shkp, loss);
#endif
- flags.botl = 1;
+ context.botl = 1;
pline("%s %s the %ld %s %sowed %s.",
Monnam(shkp), takes,
loss, currency(loss),
if(bp->bquan > obj->quan){
otmp = newobj(0);
*otmp = *obj;
- bp->bo_id = otmp->o_id = flags.ident++;
+ bp->bo_id = otmp->o_id = context.ident++;
otmp->where = OBJ_FREE;
otmp->quan = (bp->bquan -= obj->quan);
otmp->owt = 0; /* superfluous */
#else
money2mon(shkp, cost_of_damage);
#endif
- flags.botl = 1;
+ context.botl = 1;
pline("Mollified, %s accepts your restitution.",
shkname(shkp));
/* move shk back to his home loc */
} else {
You("notice you have no gold!");
u.ugold = 0;
- flags.botl = 1;
+ context.botl = 1;
}
#else
struct obj *otmp, *nobj;
You_feel("a strange sensation.");
} else {
You("notice you have no money!");
- flags.botl = 1;
+ context.botl = 1;
}
#endif
}
make_blinded(0L,TRUE);
make_sick(0L, (char *) 0, FALSE, SICK_ALL);
heal_legs();
- flags.botl = 1;
+ context.botl = 1;
break;
case 5:
take_gold();
growl_verb = growl_sound(mtmp);
if (growl_verb) {
pline("%s %s!", Monnam(mtmp), vtense((char *)0, growl_verb));
- if(flags.run) nomul(0);
+ if(context.run) nomul(0);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 18);
}
}
}
if (yelp_verb) {
pline("%s %s!", Monnam(mtmp), vtense((char *)0, yelp_verb));
- if(flags.run) nomul(0);
+ if(context.run) nomul(0);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 12);
}
}
}
if (whimper_verb) {
pline("%s %s.", Monnam(mtmp), vtense((char *)0, whimper_verb));
- if(flags.run) nomul(0);
+ if(context.run) nomul(0);
wake_nearto(mtmp->mx, mtmp->my, mtmp->data->mlevel * 6);
}
}
if (confused || (rnd(100) > chance)) {
You("fail to cast the spell correctly.");
u.uen -= energy / 2;
- flags.botl = 1;
+ context.botl = 1;
return(1);
}
u.uen -= energy;
- flags.botl = 1;
+ context.botl = 1;
exercise(A_WIS, TRUE);
/* pseudo is a temporary "false" object containing the spell stats */
pseudo = mksobj(spellid(spell), FALSE, FALSE);
if (Slimed) {
pline_The("slime disappears!");
Slimed = 0;
- /* flags.botl = 1; -- healup() handles this */
+ /* context.botl = 1; -- healup() handles this */
}
healup(0, 0, TRUE, FALSE);
break;
if (!tele_restrict(mtmp)) (void) rloc(mtmp, FALSE);
mtmp->mavenge = 1;
monflee(mtmp, 0, FALSE, FALSE);
- flags.botl = 1;
+ context.botl = 1;
}
}
Your("purse feels lighter.");
if (!tele_restrict(mtmp)) (void) rloc(mtmp, FALSE);
monflee(mtmp, 0, FALSE, FALSE);
- flags.botl = 1;
+ context.botl = 1;
}
}
#endif /* GOLDOBJ */
in_steed_dismounting = TRUE;
(void) float_down(0L, W_SADDLE);
in_steed_dismounting = FALSE;
- flags.botl = 1;
+ context.botl = 1;
(void)encumber_msg();
vision_full_recalc = 1;
} else
- flags.botl = 1;
+ context.botl = 1;
/* polearms behave differently when not mounted */
if (uwep && is_pole(uwep)) unweapon = TRUE;
return;
return(0);
} else {
u.uen -= energy;
- flags.botl = 1;
+ context.botl = 1;
}
}
schedule_goto(&newlevel, FALSE, FALSE, 0, (char *)0, (char *)0);
/* in case player just read a scroll and is about to be asked to
call it something, we can't defer until the end of the turn */
- if (u.utotype && !flags.mon_moving) deferred_goto();
+ if (u.utotype && !context.mon_moving) deferred_goto();
}
void
if (Slimed) {
pline_The("slime that covers you is burned away!");
Slimed = 0L;
- flags.botl = 1;
+ context.botl = 1;
}
return;
}
IS_DOOR(lev->typ) || IS_WALL(lev->typ)))
add_damage(x, y, /* schedule repair */
((IS_DOOR(lev->typ) || IS_WALL(lev->typ))
- && !flags.mon_moving) ? 200L : 0L);
+ && !context.mon_moving) ? 200L : 0L);
lev->doormask = 0; /* subsumes altarmask, icedpool... */
if (IS_ROOM(lev->typ)) /* && !IS_AIR(lev->typ) */
lev->typ = ROOM;
struct monst *mon = 0;
struct obj *item;
coord cc;
- boolean historic = (Role_if(PM_ARCHEOLOGIST) && !flags.mon_moving && (statue->spe & STATUE_HISTORIC));
+ boolean historic = (Role_if(PM_ARCHEOLOGIST) && !context.mon_moving && (statue->spe & STATUE_HISTORIC));
char statuename[BUFSZ];
Strcpy(statuename,the(xname(statue)));
launched (perhaps a monster triggered it), destroy context so that
next dig attempt never thinks you're resuming previous effort */
if ((otyp == BOULDER || otyp == STATUE) &&
- singleobj->ox == digging.pos.x && singleobj->oy == digging.pos.y)
- (void) memset((genericptr_t)&digging, 0, sizeof digging);
+ singleobj->ox == context.digging.pos.x &&
+ singleobj->oy == context.digging.pos.y)
+ (void) memset((genericptr_t)&context.digging, 0, sizeof(struct dig_info));
dist = distmin(x1,y1,x2,y2);
bhitpos.x = x1;
}
if (alt > num) num = alt;
if (u.mhmax > mons[u.umonnum].mlevel)
- u.mhmax -= rn2(min(u.mhmax,num + 1)), flags.botl = 1;
+ u.mhmax -= rn2(min(u.mhmax,num + 1)), context.botl = 1;
} else {
num = d(2,4);
if (u.uhpmax > u.ulevel)
- u.uhpmax -= rn2(min(u.uhpmax,num + 1)), flags.botl = 1;
+ u.uhpmax -= rn2(min(u.uhpmax,num + 1)), context.botl = 1;
}
if (!num)
You("are uninjured.");
if(u.uenmax < 0) u.uenmax = 0;
u.uen = 0;
}
- flags.botl = 1;
+ context.botl = 1;
}
int
if (u.uswallow && mtmp == u.ustuck) return FALSE;
- if (flags.forcefight) {
+ if (context.forcefight) {
/* Do this in the caller, after we checked that the monster
* didn't die from the blow. Reason: putting the 'I' there
* causes the hero to forget the square's contents since
if (canspotmon(mtmp)) {
Sprintf(qbuf, "Really attack %s?", mon_nam(mtmp));
if (yn(qbuf) != 'y') {
- flags.move = 0;
+ context.move = 0;
return(TRUE);
}
}
* you'll usually just swap places if this is a movement command
*/
/* Intelligent chaotic weapons (Stormbringer) want blood */
- if (is_safepet(mtmp) && !flags.forcefight) {
+ if (is_safepet(mtmp) && !context.forcefight) {
if (!uwep || uwep->oartifact != ART_STORMBRINGER) {
/* there are some additional considerations: this won't work
* if in a shop or Punished or you miss a random roll or
* and it returned 0 (it's okay to attack), and the monster didn't
* evade.
*/
- if (flags.forcefight && mtmp->mhp > 0 && !canspotmon(mtmp) &&
+ if (context.forcefight && mtmp->mhp > 0 && !canspotmon(mtmp) &&
!glyph_is_invisible(levl[u.ux+u.dx][u.uy+u.dy].glyph) &&
!(u.uswallow && mtmp == u.ustuck))
map_invisible(u.ux+u.dx, u.uy+u.dy);
ABASE(A_INT) += rnd(4);
if (ABASE(A_INT) > AMAX(A_INT))
ABASE(A_INT) = AMAX(A_INT);
- flags.botl = 1;
+ context.botl = 1;
}
exercise(A_WIS, TRUE);
break;
The(mdef->data->mname));
if (!Unchanging) {
Slimed = 5L;
- flags.botl = 1;
+ context.botl = 1;
}
} else
exercise(A_CON, TRUE);
pline("%s %s!", Monnam(mtmp), amt > mtmp->mhp / 2 ?
"wails in agony" : "cries out in pain");
if ((mtmp->mhp -= amt) <= 0) {
- if (flags.mon_moving)
+ if (context.mon_moving)
monkilled(mtmp, (char *)0, AD_BLND);
else
killed(mtmp);
}
}
if (mtmp->mhp > 0) {
- if (!flags.mon_moving) setmangry(mtmp);
+ if (!context.mon_moving) setmangry(mtmp);
if (tmp < 9 && !mtmp->isshk && rn2(4)) {
if (rn2(4))
monflee(mtmp, rnd(100), FALSE, TRUE);
}
}
- if (!flags.no_of_wizards)
+ if (!context.no_of_wizards)
return;
/* find Wizard, and wake him if necessary */
for(mtmp = fmon; mtmp; mtmp = mtmp->nmon)
break;
}
- if(flags.made_amulet)
+ if(context.made_amulet)
if((strat = target_on(M3_WANTSAMUL, mtmp)) != STRAT_NONE)
return(strat);
long elapsed;
const char *verb;
- if (!flags.no_of_wizards) {
+ if (!context.no_of_wizards) {
/* make a new Wizard */
verb = "kill";
mtmp = makemon(&mons[PM_WIZARD_OF_YENDOR], u.ux, u.uy, MM_NOWAIT);
void
wizdead()
{
- flags.no_of_wizards--;
+ context.no_of_wizards--;
if (!u.uevent.udemigod) {
u.uevent.udemigod = TRUE;
u.udg_cnt = rn1(250, 50);
/* Create the second worm. */
new_worm = newmonst(0);
*new_worm = *worm; /* make a copy of the old worm */
- new_worm->m_id = flags.ident++; /* make sure it has a unique id */
+ new_worm->m_id = context.ident++; /* make sure it has a unique id */
new_worm->wormno = new_wnum; /* affix new worm number */
if (worm->mtame)
for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
otmp->bypass = 0;
}
- flags.bypasses = FALSE;
+ context.bypasses = FALSE;
}
void
struct obj *obj;
{
obj->bypass = 1;
- flags.bypasses = TRUE;
+ context.bypasses = TRUE;
}
void
if(dbldam) dmg *= 2;
if (otyp == SPE_TURN_UNDEAD)
dmg += spell_damage_bonus();
- flags.bypasses = TRUE; /* for make_corpse() */
+ context.bypasses = TRUE; /* for make_corpse() */
if (!resist(mtmp, otmp->oclass, dmg, NOTELL)) {
if (mtmp->mhp > 0) monflee(mtmp, 0, FALSE, TRUE);
}
/* dropped inventory shouldn't be hit by this zap */
for (obj = mtmp->minvent; obj; obj = obj->nobj)
bypass_obj(obj);
- /* flags.bypasses = TRUE; ## for make_corpse() */
+ /* context.bypasses = TRUE; ## for make_corpse() */
/* no corpse after system shock */
xkilled(mtmp, 3);
} else if (newcham(mtmp, (struct permonst *)0,
case RIN_GAIN_STRENGTH:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_STR) -= obj->spe;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case RIN_GAIN_CONSTITUTION:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_CON) -= obj->spe;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case RIN_ADORNMENT:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_CHA) -= obj->spe;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case RIN_INCREASE_ACCURACY:
case GAUNTLETS_OF_DEXTERITY:
if ((obj->owornmask & W_ARMG) && (obj == uarmg)) {
ABON(A_DEX) -= obj->spe;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case HELM_OF_BRILLIANCE:
if ((obj->owornmask & W_ARMH) && (obj == uarmh)) {
ABON(A_INT) -= obj->spe;
ABON(A_WIS) -= obj->spe;
- flags.botl = 1;
+ context.botl = 1;
}
break;
/* case RIN_PROTECTION: not needed */
case RIN_GAIN_STRENGTH:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_STR)--;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case RIN_GAIN_CONSTITUTION:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_CON)--;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case RIN_ADORNMENT:
if ((obj->owornmask & W_RING) && u_ring) {
ABON(A_CHA)--;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case RIN_INCREASE_ACCURACY:
if ((obj->owornmask & W_ARMH) && (obj == uarmh)) {
ABON(A_INT)--;
ABON(A_WIS)--;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case GAUNTLETS_OF_DEXTERITY:
if ((obj->owornmask & W_ARMG) && (obj == uarmg)) {
ABON(A_DEX)--;
- flags.botl = 1;
+ context.botl = 1;
}
break;
case RIN_PROTECTION:
- flags.botl = 1;
+ context.botl = 1;
break;
}
if (carried(obj)) update_inventory();
* immediately revived by the same effect.
*
* The bypass bit on all objects is reset each turn, whenever
- * flags.bypasses is set.
+ * context.bypasses is set.
*
- * We check the obj->bypass bit above AND flags.bypasses
+ * We check the obj->bypass bit above AND context.bypasses
* as a safeguard against any stray occurrence left in an obj
* struct someplace, although that should never happen.
*/
- if (flags.bypasses)
+ if (context.bypasses)
return 0;
else {
#ifdef DEBUG
else if (obj->otyp == STATUE)
(void) break_statue(obj);
else {
- if (!flags.mon_moving)
+ if (!context.mon_moving)
(void)hero_breaks(obj, obj->ox, obj->oy, FALSE);
else
(void)breaks(obj, obj->ox, obj->oy);
otmp; otmp = otmp->nobj)
cancel_item(otmp);
if (youdefend) {
- flags.botl = 1; /* potential AC change */
+ context.botl = 1; /* potential AC change */
find_ac();
}
}
register struct obj *obj; /* no texts here! */
{
/* A little Sokoban guilt... */
- if (obj->otyp == BOULDER && In_sokoban(&u.uz) && !flags.mon_moving)
+ if (obj->otyp == BOULDER && In_sokoban(&u.uz) && !context.mon_moving)
change_luck(-1);
obj->otyp = ROCK;
obj_extract_self(item);
place_object(item, obj->ox, obj->oy);
}
- if (Role_if(PM_ARCHEOLOGIST) && !flags.mon_moving && (obj->spe & STATUE_HISTORIC)) {
+ if (Role_if(PM_ARCHEOLOGIST) && !context.mon_moving && (obj->spe & STATUE_HISTORIC)) {
You_feel("guilty about damaging such a historic statue.");
adjalign(-1);
}