From: nethack.rankin Date: Mon, 16 Apr 2012 00:57:37 +0000 (+0000) Subject: fix #H2633 - turning to stone or slime while limbless X-Git-Tag: MOVE2GIT~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=19945b31b0529679ddf908b78e0b89107ae23429;p=nethack fix #H2633 - turning to stone or slime while limbless Michael's fix got here first, but didn't catch the green slime case. --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index a7afe434e..2a3e46281 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/src/timeout.c b/src/timeout.c index fed93066f..d5d177673 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -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 */