From 847b037d5841f403788ec9d06366588fb74fd0ca Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Fri, 10 May 2002 01:50:22 +0000 Subject: [PATCH] #ride workaround From the newsgroup: > Apparent bug or weird-seeming feature: > If you try to mount a horse that is already in a pit, > you get the message "You lead the poor into a pit!" I checked into fixing this properly (you mount the steed and then shared its trapped status without actively retriggering the trap in the process), but the trap code is too convoluted to do that cleanly. So this "fix" just makes mounting attempts fail if the steed is trapped. (This diff is mostly whitespace cleanup.) --- doc/fixes34.1 | 1 + src/steed.c | 38 +++++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/doc/fixes34.1 b/doc/fixes34.1 index 8aa048d27..a769be14c 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -98,6 +98,7 @@ don't claim that statue comes to life if the monster it turns into is invisible fix goodpos() so worm segments don't get placed on top of each other (causing a possible display problem if the worm is cut in two) fix fountain noises on some special levels (castle, valk home, various mines) +disallow mounting a trapped steed to avoid inappropriate trap effects Platform- and/or Interface-Specific Fixes diff --git a/src/steed.c b/src/steed.c index ad7d69ecf..bb18447b0 100644 --- a/src/steed.c +++ b/src/steed.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)steed.c 3.4 2002/03/09 */ +/* SCCS Id: @(#)steed.c 3.4 2002/05/05 */ /* Copyright (c) Kevin Hugo, 1998-1999. */ /* NetHack may be freely redistributed. See license for details. */ @@ -192,7 +192,7 @@ mount_steed(mtmp, force) /* Sanity checks */ if (u.usteed) { if (!force) - You("are already riding %s.", mon_nam(u.usteed)); + You("are already riding %s.", mon_nam(u.usteed)); return (FALSE); } @@ -220,11 +220,11 @@ mount_steed(mtmp, force) #endif return (FALSE); } - + if (Upolyd && (!humanoid(youmonst.data) || verysmall(youmonst.data) || bigmonst(youmonst.data))) { if (!force) - You("won't fit on a saddle."); + You("won't fit on a saddle."); return (FALSE); } if(!force && (near_capacity() > SLT_ENCUMBER)) { @@ -233,22 +233,21 @@ mount_steed(mtmp, force) } /* Can the player reach and see the monster? */ - if (u.uswallow || u.ustuck || u.utrap || Punished) { - if (!force) { + if (u.uswallow || u.ustuck || u.utrap || Punished) { + if (!force) { if (Punished) - You("are unable to swing your %s over.", - body_part(LEG)); + You("are unable to swing your %s over.", body_part(LEG)); else - You("are stuck here for now."); + You("are stuck here for now."); + } + return (FALSE); } - return (FALSE); - } if (!mtmp || (!force && ((Blind && !Blind_telepat) || mtmp->mundetected || mtmp->m_ap_type == M_AP_FURNITURE || mtmp->m_ap_type == M_AP_OBJECT))) { if (!force) - pline("I see nobody there."); + pline("I see nobody there."); return (FALSE); } @@ -263,14 +262,23 @@ mount_steed(mtmp, force) char kbuf[BUFSZ]; You("touch %s.", mon_nam(mtmp)); - Sprintf(kbuf, "attempting to ride %s", an(mtmp->data->mname)); + Sprintf(kbuf, "attempting to ride %s", an(mtmp->data->mname)); instapetrify(kbuf); } if (!mtmp->mtame || mtmp->isminion) { if (!force) - pline("I think %s would mind.", mon_nam(mtmp)); + pline("I think %s would mind.", mon_nam(mtmp)); return (FALSE); } + if (mtmp->mtrapped) { + struct trap *t = t_at(mtmp->mx, mtmp->my); + + You_cant("mount %s while %s's trapped in %s.", + mon_nam(mtmp), mhe(mtmp), + an(defsyms[trap_to_defsym(t->ttyp)].explanation)); + return (FALSE); + } + if (!force && !Role_if(PM_KNIGHT) && !(--mtmp->mtame)) { /* no longer tame */ newsym(mtmp->mx, mtmp->my); @@ -285,7 +293,7 @@ mount_steed(mtmp, force) } if (!can_saddle(mtmp) || !can_ride(mtmp)) { if (!force) - You_cant("ride such a creature."); + You_cant("ride such a creature."); return (0); }