fix pull request #470 - two riding fixes
Post-3.6 change to monster inventory handling could result in hero remaining mounted on an unsaddled steed (if saddle was removed via opening magic). Hero falling out of saddle would fall to the ground and take damage even if levitating or flying without steed's help after dismount. Fixes #470
This commit is contained in:
@@ -671,7 +671,7 @@ mdrop_obj(
|
||||
boolean verbosely)
|
||||
{
|
||||
int omx = mon->mx, omy = mon->my;
|
||||
boolean unwornmask = obj->owornmask;
|
||||
long unwornmask = obj->owornmask;
|
||||
|
||||
extract_from_minvent(mon, obj, FALSE, TRUE);
|
||||
/* don't charge for an owned saddle on dead steed (provided
|
||||
|
||||
24
src/steed.c
24
src/steed.c
@@ -482,30 +482,38 @@ dismount_steed(
|
||||
{
|
||||
struct monst *mtmp;
|
||||
struct obj *otmp;
|
||||
const char *verb;
|
||||
coord cc, steedcc;
|
||||
const char *verb = "fall";
|
||||
boolean repair_leg_damage = (Wounded_legs != 0L);
|
||||
unsigned save_utrap = u.utrap;
|
||||
boolean have_spot = landing_spot(&cc, reason, 0);
|
||||
boolean ulev, ufly,
|
||||
repair_leg_damage = (Wounded_legs != 0L),
|
||||
have_spot = landing_spot(&cc, reason, 0);
|
||||
|
||||
mtmp = u.usteed; /* make a copy of steed pointer */
|
||||
/* Sanity check */
|
||||
if (!mtmp) /* Just return silently */
|
||||
return;
|
||||
u.usteed = 0; /* affects Fly test; could hypothetically affect Lev */
|
||||
ufly = Flying ? TRUE : FALSE;
|
||||
ulev = Levitation ? TRUE : FALSE;
|
||||
u.usteed = mtmp;
|
||||
|
||||
/* Check the reason for dismounting */
|
||||
otmp = which_armor(mtmp, W_SADDLE);
|
||||
switch (reason) {
|
||||
case DISMOUNT_THROWN:
|
||||
verb = "are thrown";
|
||||
/*FALLTHRU*/
|
||||
case DISMOUNT_FELL:
|
||||
verb = (reason == DISMOUNT_THROWN) ? "are thrown"
|
||||
: ulev ? "float" : ufly ? "fly" : "fall";
|
||||
You("%s off of %s!", verb, mon_nam(mtmp));
|
||||
if (!have_spot)
|
||||
have_spot = landing_spot(&cc, reason, 1);
|
||||
losehp(Maybe_Half_Phys(rn1(10, 10)), "riding accident", KILLED_BY_AN);
|
||||
set_wounded_legs(BOTH_SIDES, (int) HWounded_legs + rn1(5, 5));
|
||||
repair_leg_damage = FALSE;
|
||||
if (!ulev && !ufly) {
|
||||
losehp(Maybe_Half_Phys(rn1(10, 10)), "riding accident",
|
||||
KILLED_BY_AN);
|
||||
set_wounded_legs(BOTH_SIDES, (int) HWounded_legs + rn1(5, 5));
|
||||
repair_leg_damage = FALSE;
|
||||
}
|
||||
break;
|
||||
case DISMOUNT_POLY:
|
||||
You("can no longer ride %s.", mon_nam(u.usteed));
|
||||
|
||||
24
src/worn.c
24
src/worn.c
@@ -1035,20 +1035,24 @@ racial_exception(struct monst *mon, struct obj *obj)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Remove an object from a monster's inventory.
|
||||
* At its core this is just obj_extract_self(), but it also handles any updates
|
||||
* that needs to happen if the gear is equipped or in some other sort of state
|
||||
* that needs handling.
|
||||
* Note that like obj_extract_self(), this leaves obj free. */
|
||||
/* Remove an object from a monster's inventory. */
|
||||
void
|
||||
extract_from_minvent(struct monst *mon, struct obj *obj,
|
||||
boolean do_intrinsics, /* whether to call
|
||||
update_mon_intrinsics */
|
||||
boolean silently) /* doesn't affect all possible messages,
|
||||
just update_mon_intrinsics's */
|
||||
extract_from_minvent(
|
||||
struct monst *mon,
|
||||
struct obj *obj,
|
||||
boolean do_intrinsics, /* whether to call update_mon_intrinsics */
|
||||
boolean silently) /* doesn't affect all possible messages,
|
||||
* just update_mon_intrinsics's */
|
||||
{
|
||||
long unwornmask = obj->owornmask;
|
||||
|
||||
/*
|
||||
* At its core this is just obj_extract_self(), but it also handles
|
||||
* any updates that need to happen if the gear is equipped or in
|
||||
* some other sort of state that needs handling.
|
||||
* Note that like obj_extract_self(), this leaves obj free.
|
||||
*/
|
||||
|
||||
if (obj->where != OBJ_MINVENT) {
|
||||
impossible("extract_from_minvent called on object not in minvent");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user