]> granicus.if.org Git - nethack/commitdiff
fix #H2633 - turning to stone or slime while limbless
authornethack.rankin <nethack.rankin>
Mon, 16 Apr 2012 00:57:37 +0000 (00:57 +0000)
committernethack.rankin <nethack.rankin>
Mon, 16 Apr 2012 00:57:37 +0000 (00:57 +0000)
     Michael's fix got here first, but didn't catch the green slime case.

doc/fixes35.0
src/timeout.c

index a7afe434e83530bd567670e4f983b1bd696e0cab..2a3e46281025ba869ce8369c5ceae178dd755b97 100644 (file)
@@ -828,6 +828,7 @@ fix message given when part of a stack of items in a monster's inventory is
        being destroyed
 add "Boing!" message when hero zaps resistant monster with striking/force bolt
 adjust gaze reflection message when your scales are embedded in your skin
+adjust turning-to-stone or -slime messages when you have no limbs
 
 
 Platform- and/or Interface-Specific Fixes
index fed93066fe791ee77e6bfef8702b47a2630a4bab..d5d1776735dbae047969c3f7b8e869c1bfc81036 100644 (file)
@@ -26,13 +26,15 @@ static NEARDATA const char * const stoned_texts[] = {
 STATIC_OVL void
 stoned_dialogue()
 {
-       char buf[BUFSZ];
        register long i = (Stoned & TIMEOUT);
 
        if (i > 0L && i <= SIZE(stoned_texts)) {
-               Strcpy(buf,stoned_texts[SIZE(stoned_texts) - i]);
-               pline1(nolimbs(youmonst.data) ?
-                       strsubst(buf, "limbs", "extremities") : buf);
+               char buf[BUFSZ];
+
+               Strcpy(buf, stoned_texts[SIZE(stoned_texts) - i]);
+               if (nolimbs(youmonst.data) && strstri(buf, "limbs"))
+                       (void) strsubst(buf, "limbs", "extremities");
+               pline1(buf);
        }
        switch ((int) i) {
        case 5:         /* slowing down */
@@ -149,18 +151,21 @@ slime_dialogue()
 {
        register long i = (Slimed & TIMEOUT) / 2L;
 
-       if (((Slimed & TIMEOUT) % 2L) && i >= 0L
-               && i < SIZE(slime_texts)) {
-           const char *str = slime_texts[SIZE(slime_texts) - i - 1L];
+       if (((Slimed & TIMEOUT) % 2L) && i >= 0L && i < SIZE(slime_texts)) {
+           char buf[BUFSZ];
+
+           Strcpy(buf, slime_texts[SIZE(slime_texts) - i - 1L]);
+           if (nolimbs(youmonst.data) && strstri(buf, "limbs"))
+               (void) strsubst(buf, "limbs", "extremities");
 
-           if (index(str, '%')) {
+           if (index(buf, '%')) {
                if (i == 4L) {  /* "you are turning green" */
                    if (!Blind) /* [what if you're already green?] */
-                       pline(str, hcolor(NH_GREEN));
+                       pline(buf, hcolor(NH_GREEN));
                } else
-                   pline(str, an(Hallucination ? rndmonnam() : "green slime"));
+                   pline(buf, an(Hallucination ? rndmonnam() : "green slime"));
            } else
-               pline1(str);
+               pline1(buf);
        }
        if (i == 3L) {  /* limbs becoming oozy */
            HFast = 0L; /* lose intrinsic speed */