From 2ea8666583b343f4ef7aa366162d905476537a70 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 19 May 2016 22:01:41 +0300 Subject: [PATCH] Interrupt a multi turn action if hp or pw is restored to maximum via UnNetHack by Patric Mueller --- doc/fixes36.1 | 1 + src/allmain.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 5759146aa..ed84570db 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -377,6 +377,7 @@ during end of game disclosure, the vanquished monsters list can be sorted in one of several ways by answering 'a' to "disclose vanquished monsters?" when #terrain is displaying a censored version of the map (no monsters, &c), moving the cursor will display farlook's brief autodescribe feedback +interrupt a multi turn action if hp or pw is restored to maximum Platform- and/or Interface-Specific New Features diff --git a/src/allmain.c b/src/allmain.c index 7d7ff03c6..33afd9927 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -13,6 +13,7 @@ #ifdef POSITIONBAR STATIC_DCL void NDECL(do_positionbar); #endif +STATIC_DCL void FDECL(interrupt_multi, (const char *)); void moveloop(resuming) @@ -216,6 +217,8 @@ boolean resuming; || (wtcap < MOD_ENCUMBER && !(moves % 20))) { context.botl = 1; u.mh++; + if (u.mh >= u.mhmax) + interrupt_multi("You are in full health."); } } else if (u.uhp < u.uhpmax && (wtcap < MOD_ENCUMBER || !u.umoved @@ -234,6 +237,8 @@ boolean resuming; u.uhp += heal; if (u.uhp > u.uhpmax) u.uhp = u.uhpmax; + if (u.uhp >= u.uhpmax) + interrupt_multi("You are in full health."); } else if (Regeneration || (u.ulevel <= 9 && !(moves @@ -241,6 +246,8 @@ boolean resuming; + 1)))) { context.botl = 1; u.uhp++; + if (u.uhp >= u.uhpmax) + interrupt_multi("You are in full health."); } } @@ -270,6 +277,8 @@ boolean resuming; if (u.uen > u.uenmax) u.uen = u.uenmax; context.botl = 1; + if (u.uen >= u.uenmax) + interrupt_multi("You feel full of energy."); } if (!u.uinvulnerable) { @@ -690,4 +699,16 @@ do_positionbar() } #endif +STATIC_DCL void +interrupt_multi(msg) +const char *msg; +{ + if (multi > 0 && !context.travel) { + nomul(0); + if (flags.verbose && msg) + Norep("%s", msg); + } +} + + /*allmain.c*/ -- 2.40.0