diff --git a/include/extern.h b/include/extern.h index 69ac1eec2..8fd85e91e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -390,7 +390,7 @@ E void FDECL(revive_mon, (ANY_P *, long)); E int NDECL(donull); E int NDECL(dowipe); E void FDECL(set_wounded_legs, (long, int)); -E void NDECL(heal_legs); +E void FDECL(heal_legs, (int)); /* ### do_name.c ### */ diff --git a/src/do.c b/src/do.c index bcae4ca43..00f0b8edd 100644 --- a/src/do.c +++ b/src/do.c @@ -1882,7 +1882,8 @@ register int timex; } void -heal_legs() +heal_legs(how) +int how; /* 0: ordinary, 1: dismounting steed, 2: limbs turn to stone */ { if (Wounded_legs) { if (ATEMP(A_DEX) < 0) { @@ -1890,7 +1891,11 @@ heal_legs() context.botl = 1; } - if (!u.usteed) { + /* when mounted, wounded legs applies to the steed; + during petrification countdown, "your limbs turn to stone" + before the final stages and that calls us (how==2) to cure + wounded legs, but we want to suppress the feel better message */ + if (!u.usteed && how != 2) { const char *legs = body_part(LEG); if ((EWounded_legs & BOTH_SIDES) == BOTH_SIDES) @@ -1900,7 +1905,7 @@ heal_legs() Your("%s %s better.", legs, vtense(legs, "feel")); } - HWounded_legs = EWounded_legs = 0; + HWounded_legs = EWounded_legs = 0L; /* Wounded_legs reduces carrying capacity, so we want an encumbrance check when they're healed. However, @@ -1912,7 +1917,7 @@ heal_legs() it might be immediately contradicted [able to carry more when steed becomes healthy, then possible floor feedback, then able to carry less when back on foot]. */ - if (!in_steed_dismounting) + if (how == 0) (void) encumber_msg(); } } diff --git a/src/eat.c b/src/eat.c index cff0a12fd..0d5e83ab2 100644 --- a/src/eat.c +++ b/src/eat.c @@ -2217,7 +2217,7 @@ struct obj *otmp; } } if (!otmp->cursed) - heal_legs(); + heal_legs(0); break; case EGG: if (flesh_petrifies(&mons[otmp->corpsenm])) { diff --git a/src/potion.c b/src/potion.c index 281a2e4a3..9ee433061 100644 --- a/src/potion.c +++ b/src/potion.c @@ -106,6 +106,9 @@ boolean talk; set_itimeout(&HStun, xtime); } +/* Sick is overloaded with both fatal illness and food poisoning (via + u.usick_type bit mask), but delayed killer can only support one or + the other at a time. They should become separate intrinsics.... */ void make_sick(xtime, cause, talk, type) long xtime; @@ -116,7 +119,7 @@ int type; struct kinfo *kptr; long old = Sick; -#if 0 +#if 0 /* tell player even if hero is unconscious */ if (Unaware) talk = FALSE; #endif @@ -152,7 +155,10 @@ int type; kptr = find_delayed_killer(SICK); if (Sick) { exercise(A_CON, FALSE); - if (!old || !kptr) { + /* setting delayed_killer used to be unconditional, but that's + not right when make_sick(0) is called to cure food poisoning + if hero was also fatally ill; this is only approximate */ + if (xtime || !old || !kptr) { int kpfx = ((cause && !strcmp(cause, "#wizintrinsic")) ? KILLED_BY : KILLED_BY_AN); @@ -169,7 +175,7 @@ const char *msg; { long old = Slimed; -#if 0 +#if 0 /* tell player even if hero is unconscious */ if (Unaware) msg = 0; #endif @@ -177,7 +183,7 @@ const char *msg; if ((xtime != 0L) ^ (old != 0L)) { context.botl = TRUE; if (msg) - pline1(msg); + pline("%s", msg); } if (!Slimed) dealloc_killer(find_delayed_killer(SLIMED)); @@ -193,7 +199,7 @@ const char *killername; { long old = Stoned; -#if 0 +#if 0 /* tell player even if hero is unconscious */ if (Unaware) msg = 0; #endif @@ -201,7 +207,7 @@ const char *killername; if ((xtime != 0L) ^ (old != 0L)) { context.botl = TRUE; if (msg) - pline1(msg); + pline("%s", msg); } if (!Stoned) dealloc_killer(find_delayed_killer(STONED)); @@ -899,9 +905,9 @@ register struct obj *otmp; } break; case POT_SPEED: + /* skip when mounted; heal_legs() would heal steeds legs */ if (Wounded_legs && !otmp->cursed && !u.usteed) { - /* heal_legs() would heal steeds legs */ - heal_legs(); + heal_legs(0); unkn++; break; } diff --git a/src/pray.c b/src/pray.c index 5569c33f0..e1f55cb49 100644 --- a/src/pray.c +++ b/src/pray.c @@ -524,7 +524,7 @@ int trouble; break; } case TROUBLE_WOUNDED_LEGS: - heal_legs(); + heal_legs(0); break; case TROUBLE_STUNNED: make_stunned(0L, TRUE); diff --git a/src/sit.c b/src/sit.c index 0f8bedbb4..1aa8085bf 100644 --- a/src/sit.c +++ b/src/sit.c @@ -188,7 +188,7 @@ dosit() u.ucreamed = 0; make_blinded(0L, TRUE); make_sick(0L, (char *) 0, FALSE, SICK_ALL); - heal_legs(); + heal_legs(0); context.botl = 1; break; case 5: diff --git a/src/steed.c b/src/steed.c index 8cbf9d0ef..6b940c26e 100644 --- a/src/steed.c +++ b/src/steed.c @@ -221,7 +221,7 @@ boolean force; /* Quietly force this animal */ if (Wounded_legs) { Your("%s are in no shape for riding.", makeplural(body_part(LEG))); if (force && wizard && yn("Heal your legs?") == 'y') - HWounded_legs = EWounded_legs = 0; + HWounded_legs = EWounded_legs = 0L; else return (FALSE); } @@ -542,12 +542,8 @@ int reason; /* Player was thrown off etc. */ } /* While riding, Wounded_legs refers to the steed's legs; after dismounting, it reverts to the hero's legs. */ - if (repair_leg_damage) { - /* [TODO: make heal_legs() take a parameter to handle this] */ - in_steed_dismounting = TRUE; - heal_legs(); - in_steed_dismounting = FALSE; - } + if (repair_leg_damage) + heal_legs(1); /* Release the steed and saddle */ u.usteed = 0; diff --git a/src/timeout.c b/src/timeout.c index 1360f1132..110aa03ad 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -137,17 +137,17 @@ stoned_dialogue() multi_reason = "getting stoned"; nomovemsg = You_can_move_again; /* not unconscious */ /* "your limbs have turned to stone" so terminate wounded legs */ - if ((HWounded_legs & TIMEOUT) != 0L && !u.usteed) - set_itimeout(&HWounded_legs, 0L); + if (Wounded_legs && !u.usteed) + heal_legs(2); break; case 2: /* turned to stone */ if ((HDeaf & TIMEOUT) > 0L && (HDeaf & TIMEOUT) < 5L) set_itimeout(&HDeaf, 5L); /* avoid Hear_again at tail end */ - /* if also vomiting or turning into slime, stop those */ - if ((Vomiting & TIMEOUT) != 0L) - set_itimeout(&Vomiting, 0L), context.botl = 1; - if ((Slimed & TIMEOUT) != 0L) - set_itimeout(&Slimed, 0L), context.botl = 1; + /* if also vomiting or turning into slime, stop those (no messages) */ + if (Vomiting) + make_vomiting(0L, FALSE); + if (Slimed) + make_slimed(0L, (char *) 0); break; default: break; @@ -342,8 +342,8 @@ slime_dialogue() break; case 1L: /* turning into slime */ /* if also turning to stone, stop doing that (no message) */ - if ((Stoned & TIMEOUT) != 0L) - set_itimeout(&Stoned, 0L), context.botl = 1; + if (Stoned) + make_stoned(0L, (char *) 0, KILLED_BY_AN, (char *) 0); break; } exercise(A_DEX, FALSE); @@ -553,7 +553,7 @@ nh_timeout() stop_occupation(); break; case WOUNDED_LEGS: - heal_legs(); + heal_legs(0); stop_occupation(); break; case HALLUC: