#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 <foo> 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.)
This commit is contained in:
nethack.rankin
2002-05-10 01:50:22 +00:00
parent e6f9748511
commit 847b037d58
2 changed files with 24 additions and 15 deletions

View File

@@ -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

View File

@@ -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);
}