-/* NetHack 3.6 extern.h $NHDT-Date: 1583073988 2020/03/01 14:46:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.809 $ */
+/* NetHack 3.6 extern.h $NHDT-Date: 1584405113 2020/03/17 00:31:53 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.814 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
E void NDECL(lookaround);
E boolean FDECL(crawl_destination, (int, int));
E int NDECL(monster_nearby);
+E void FDECL(end_running, (BOOLEAN_P));
E void FDECL(nomul, (int));
E void FDECL(unmul, (const char *));
E void FDECL(losehp, (int, const char *, BOOLEAN_P));
-/* NetHack 3.6 allmain.c $NHDT-Date: 1580044340 2020/01/26 13:12:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.138 $ */
+/* NetHack 3.6 allmain.c $NHDT-Date: 1584405115 2020/03/17 00:31:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.143 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
g.monstermoves++; /* [obsolete (for a long time...)] */
g.moves++;
+ if (flags.time && !g.context.run)
+ iflags.time_botl = TRUE; /* 'moves' just changed */
+
/********************************/
/* once-per-turn things go here */
/********************************/
if (u.ublesscnt)
u.ublesscnt--;
- if (flags.time && !g.context.run)
- iflags.time_botl = TRUE;
/* One possible result of prayer is healing. Whether or
* not you get healed depends on your current hit points.
if (!g.multi) {
/* lookaround may clear multi */
g.context.move = 0;
- if (flags.time)
- g.context.botl = TRUE;
continue;
}
if (g.context.mv) {
}
if (u.utotype) /* change dungeon level */
deferred_goto(); /* after rhack() */
- /* !g.context.move here: multiple movement command stopped */
- else if (flags.time && (!g.context.move || !g.context.mv))
- g.context.botl = TRUE;
if (g.vision_full_recalc)
vision_recalc(0); /* vision! */
-/* NetHack 3.6 eat.c $NHDT-Date: 1577190688 2019/12/24 12:31:28 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.222 $ */
+/* NetHack 3.6 eat.c $NHDT-Date: 1584405116 2020/03/17 00:31:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.223 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
switch (newhs) {
case HUNGRY:
if (Hallucination) {
- You((!incr) ? "now have a lesser case of the munchies."
- : "are getting the munchies.");
+ You(!incr ? "now have a lesser case of the munchies."
+ : "are getting the munchies.");
} else
- You((!incr) ? "only feel hungry now."
- : (u.uhunger < 145)
- ? "feel hungry."
- : "are beginning to feel hungry.");
+ You(!incr ? "only feel hungry now."
+ : (u.uhunger < 145) ? "feel hungry."
+ : "are beginning to feel hungry.");
if (incr && g.occupation
&& (g.occupation != eatfood && g.occupation != opentin))
stop_occupation();
- g.context.travel = g.context.travel1 = g.context.mv = g.context.run = 0;
+ end_running(TRUE);
break;
case WEAK:
if (Hallucination)
? g.urole.name.m
: "Elf");
else
- You((!incr)
- ? "feel weak now."
- : (u.uhunger < 45) ? "feel weak."
- : "are beginning to feel weak.");
+ You(!incr ? "feel weak now."
+ : (u.uhunger < 45) ? "feel weak."
+ : "are beginning to feel weak.");
if (incr && g.occupation
&& (g.occupation != eatfood && g.occupation != opentin))
stop_occupation();
- g.context.travel = g.context.travel1 = g.context.mv = g.context.run = 0;
+ end_running(TRUE);
break;
}
u.uhs = newhs;
-/* NetHack 3.6 hack.c $NHDT-Date: 1582799171 2020/02/27 10:26:11 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.249 $ */
+/* NetHack 3.6 hack.c $NHDT-Date: 1584405116 2020/03/17 00:31:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.250 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
if ((mode == TRAVP_TRAVEL || mode == TRAVP_VALID) && g.context.travel1
&& distmin(u.ux, u.uy, u.tx, u.ty) == 1
&& !(u.ux != u.tx && u.uy != u.ty && NODIAG(u.umonnum))) {
- g.context.run = 0;
+ end_running(FALSE);
if (test_move(u.ux, u.uy, u.tx - u.ux, u.ty - u.uy, TEST_MOVE)) {
if (mode == TRAVP_TRAVEL) {
u.dx = u.tx - u.ux;
}
if (g.context.run && flags.runmode != RUN_TPORT) {
- /* display every step or every 7th step depending upon mode */
+ /* for tport mode, don't display anything until we've stopped;
+ for normal (leap) mode, update display every 7th step
+ (relative to turn counter; ought to be to start of running);
+ for walk and crawl (visual debugging) modes, update the
+ display after every step */
if (flags.runmode != RUN_LEAP || !(g.moves % 7L)) {
- if (flags.time)
- iflags.time_botl = 1;
+ /* moveloop() suppresses time_botl when running */
+ iflags.time_botl = flags.time;
curs_on_u();
delay_output();
if (flags.runmode == RUN_CRAWL) {
return 0;
}
+void
+end_running(and_travel)
+boolean and_travel;
+{
+ /* moveloop() suppresses time_botl when context.run is non-zero; when
+ running stops, update 'time' even if other botl status is unchanged */
+ if (flags.time && g.context.run)
+ iflags.time_botl = TRUE;
+ g.context.run = 0;
+ /* 'context.mv' isn't travel but callers who want to end travel
+ all clear it too */
+ if (and_travel)
+ g.context.travel = g.context.travel1 = g.context.mv = 0;
+}
+
void
nomul(nval)
int nval;
g.multi = nval;
if (nval == 0)
g.multi_reason = NULL;
- g.context.travel = g.context.travel1 = g.context.mv = g.context.run = 0;
+ end_running(TRUE);
}
/* called when a non-movement, multi-turn action has completed */
unmul(msg_override)
const char *msg_override;
{
- g.context.botl = 1;
+ g.context.botl = TRUE;
g.multi = 0; /* caller will usually have done this already */
if (msg_override)
g.nomovemsg = msg_override;
register const char *knam;
boolean k_format;
{
+#if 0 /* code below is prepared to handle negative 'loss' so don't add this
+ * until we've verified that no callers intentionally rely on that */
+ if (n <= 0) {
+ impossible("hero losing %d hit points due to \"%s\"?", n, knam);
+ return;
+ }
+#endif
+ g.context.botl = TRUE; /* u.uhp or u.mh is changing */
+ end_running(TRUE);
if (Upolyd) {
u.mh -= n;
if (u.mhmax < u.mh)
u.mhmax = u.mh;
- g.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 */
- else
- g.context.travel = g.context.travel1 = g.context.mv = g.context.run = 0;
- g.context.botl = 1;
if (u.uhp < 1) {
g.killer.format = k_format;
if (g.killer.name != knam) /* the thing that killed you */
-/* NetHack 3.6 uhitm.c $NHDT-Date: 1581886869 2020/02/16 21:01:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.227 $ */
+/* NetHack 3.6 uhitm.c $NHDT-Date: 1584405117 2020/03/17 00:31:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.228 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
Strcpy(buf, y_monnam(mtmp));
buf[0] = highc(buf[0]);
You("stop. %s is in the way!", buf);
- g.context.travel = g.context.travel1 = g.context.mv = g.context.run
- = 0;
+ end_running(TRUE);
return TRUE;
} else if ((mtmp->mfrozen || (!mtmp->mcanmove)
|| (mtmp->data->mmove == 0)) && rn2(6)) {
pline("%s doesn't seem to move!", Monnam(mtmp));
- g.context.travel = g.context.travel1 = g.context.mv = g.context.run
- = 0;
+ end_running(TRUE);
return TRUE;
} else
return FALSE;