steed fixes
A relatively recent change to prevent #ride letting you move in
a way you could walk (squeeze through a tight a gap or enter doorway
diagonally) resulted in crashing due to access violation or segfault
if you tried to mount toward a spot that didn't contain any monster.
Noticed while testing saddle cursing; tried to mount while stunned....
Also, if the character had a saddle "worn" in weapon, alternate
weapon, or quiver slot, it didn't get unworn when applying the saddle
to a mount. The next time the player tried to equip something in the
same slot there'd be a warning message; I don't know whether any more
serious symptoms could occur.
This commit is contained in:
+10
-8
@@ -132,6 +132,7 @@ use_saddle(otmp)
|
|||||||
/* Make the attempt */
|
/* Make the attempt */
|
||||||
if (rn2(100) < chance) {
|
if (rn2(100) < chance) {
|
||||||
You("put the saddle on %s.", mon_nam(mtmp));
|
You("put the saddle on %s.", mon_nam(mtmp));
|
||||||
|
if (otmp->owornmask) remove_worn_item(otmp, FALSE);
|
||||||
freeinv(otmp);
|
freeinv(otmp);
|
||||||
/* mpickobj may free otmp it if merges, but we have already
|
/* mpickobj may free otmp it if merges, but we have already
|
||||||
checked for a saddle above, so no merger should happen */
|
checked for a saddle above, so no merger should happen */
|
||||||
@@ -230,6 +231,13 @@ mount_steed(mtmp, force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Can the player reach and see the monster? */
|
/* Can the player reach and see the monster? */
|
||||||
|
if (!mtmp || (!force && ((Blind && !Blind_telepat) ||
|
||||||
|
mtmp->mundetected ||
|
||||||
|
mtmp->m_ap_type == M_AP_FURNITURE ||
|
||||||
|
mtmp->m_ap_type == M_AP_OBJECT))) {
|
||||||
|
pline("I see nobody there.");
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
if (u.uswallow || u.ustuck || u.utrap || Punished ||
|
if (u.uswallow || u.ustuck || u.utrap || Punished ||
|
||||||
!test_move(u.ux, u.uy, mtmp->mx-u.ux, mtmp->my-u.uy, TEST_MOVE)) {
|
!test_move(u.ux, u.uy, mtmp->mx-u.ux, mtmp->my-u.uy, TEST_MOVE)) {
|
||||||
if (Punished || !(u.uswallow || u.ustuck || u.utrap))
|
if (Punished || !(u.uswallow || u.ustuck || u.utrap))
|
||||||
@@ -238,13 +246,6 @@ mount_steed(mtmp, force)
|
|||||||
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))) {
|
|
||||||
pline("I see nobody there.");
|
|
||||||
return (FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Is this a valid monster? */
|
/* Is this a valid monster? */
|
||||||
otmp = which_armor(mtmp, W_SADDLE);
|
otmp = which_armor(mtmp, W_SADDLE);
|
||||||
@@ -487,7 +488,8 @@ dismount_steed(reason)
|
|||||||
case DISMOUNT_BYCHOICE:
|
case DISMOUNT_BYCHOICE:
|
||||||
default:
|
default:
|
||||||
if (otmp && otmp->cursed) {
|
if (otmp && otmp->cursed) {
|
||||||
You("can't. The saddle seems to be cursed.");
|
You("can't. The saddle %s cursed.",
|
||||||
|
otmp->bknown ? "is" : "seems to be");
|
||||||
otmp->bknown = TRUE;
|
otmp->bknown = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user