]> granicus.if.org Git - nethack/commitdiff
fix pull request #380 - turning into slime
authorPatR <rankin@nethack.org>
Thu, 27 Aug 2020 23:14:17 +0000 (16:14 -0700)
committerPatR <rankin@nethack.org>
Thu, 27 Aug 2020 23:14:17 +0000 (16:14 -0700)
The turn-to-slime countdown is one of the ones that uses turns/2
to stretch the sequence out longer and it was displaying the hero
as green slime when there was another turn before it happened.
(In theory anyway.  I could not get my hero to be shown as slime
and still have one move left, even when hasted.)

Make the hero mimic green slime starting on the last turn before
being polymorphed instead of next to last.

Fixes #380

doc/fixes37.0
src/timeout.c

index 4a638b5f0ea75fea3c4d868871f1972e25e0e5e3..d4c1b262854590b78ff150fc66610bd2da6d4118 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.289 $ $NHDT-Date: 1597967807 2020/08/20 23:56:47 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.290 $ $NHDT-Date: 1598570054 2020/08/27 23:14:14 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -247,6 +247,7 @@ leashing or unleashing pets wasn't updating persistent inventory window
 end of game inventory disclosure passed an inappropriate argument to the
        inventory display routine; not noticeable for tty and curses,
        noticeable but not harmful for X11, and slightly harmful for Qt
+turning into slime rendered hero as slime one turn too soon
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index fb24b87f035e85fbdca14255510bcde3607aa9df..ca24e94b98b6012dc6d7d3e245a57e139d745409 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 timeout.c       $NHDT-Date: 1596498217 2020/08/03 23:43:37 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.118 $ */
+/* NetHack 3.7 timeout.c       $NHDT-Date: 1598570054 2020/08/27 23:14:14 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.119 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2018. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -316,16 +316,20 @@ static NEARDATA const char *const slime_texts[] = {
 static void
 slime_dialogue()
 {
-    register long i = (Slimed & TIMEOUT) / 2L;
+    long t = (Slimed & TIMEOUT), i = t / 2L;
 
-    if (i == 1L) {
+    if (t == 1L) {
         /* display as green slime during "You have become green slime."
            but don't worry about not being able to see self; if already
            mimicking something else at the time, implicitly be revealed */
         g.youmonst.m_ap_type = M_AP_MONSTER;
         g.youmonst.mappearance = PM_GREEN_SLIME;
+        /* no message given when 't' is odd, so no automatic update of
+           self; force one */
+        newsym(u.ux, u.uy);
     }
-    if (((Slimed & TIMEOUT) % 2L) && i >= 0L && i < SIZE(slime_texts)) {
+
+    if ((t % 2L) != 0L && i >= 0L && i < SIZE(slime_texts)) {
         char buf[BUFSZ];
 
         Strcpy(buf, slime_texts[SIZE(slime_texts) - i - 1L]);
@@ -2403,7 +2407,7 @@ long adjust;     /* how much to adjust timeout */
     /* restore elements */
     if (nhfp->structlevel)
         mread(nhfp->fd, (genericptr_t) &count, sizeof count);
-       
+
     while (count-- > 0) {
         curr = (timer_element *) alloc(sizeof(timer_element));
         if (nhfp->structlevel)