B04003 - keep saddle with steed corpse if possible

This commit is contained in:
nethack.allison
2003-07-13 13:22:19 +00:00
parent 567a501bdd
commit f8abb8c8cc
2 changed files with 46 additions and 2 deletions

View File

@@ -101,6 +101,7 @@ update pit trapped time when polymorphing to or from a monster that passes_walls
show artifact hit message which affect the monster that swallowed the hero show artifact hit message which affect the monster that swallowed the hero
revived pet corpse from bones file should not be loyal to current player revived pet corpse from bones file should not be loyal to current player
finding a statue trap you are about to dig should stop your occupation finding a statue trap you are about to dig should stop your occupation
try to keep saddle at the same location as the steed corpse
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes

View File

@@ -26,6 +26,8 @@ STATIC_DCL int FDECL(mkroll_launch,
STATIC_DCL boolean FDECL(isclearpath,(coord *, int, SCHAR_P, SCHAR_P)); STATIC_DCL boolean FDECL(isclearpath,(coord *, int, SCHAR_P, SCHAR_P));
#ifdef STEED #ifdef STEED
STATIC_OVL int FDECL(steedintrap, (struct trap *, struct obj *)); STATIC_OVL int FDECL(steedintrap, (struct trap *, struct obj *));
STATIC_OVL boolean FDECL(keep_saddle_with_steedcorpse,
(unsigned, struct obj *, struct obj *));
#endif #endif
#ifndef OVLB #ifndef OVLB
@@ -519,6 +521,37 @@ boolean shatter;
return mtmp; return mtmp;
} }
#ifdef STEED
STATIC_OVL boolean
keep_saddle_with_steedcorpse(steed_mid, objchn, saddle)
unsigned steed_mid;
struct obj *objchn, *saddle;
{
if (!saddle) return FALSE;
while(objchn) {
if(objchn->otyp == CORPSE &&
objchn->oattached == OATTACHED_MONST && objchn->oxlth) {
struct monst *mtmp = (struct monst *)objchn->oextra;
if (mtmp->m_id == steed_mid) {
/* move saddle */
xchar x,y;
if (get_obj_location(objchn, &x, &y, 0)) {
obj_extract_self(saddle);
place_object(saddle, x, y);
stackobj(saddle);
}
return TRUE;
}
}
if (Has_contents(objchn) &&
keep_saddle_with_steedcorpse(steed_mid, objchn->cobj, saddle))
return TRUE;
objchn = objchn->nobj;
}
return FALSE;
}
#endif /*STEED*/
void void
dotrap(trap, trflags) dotrap(trap, trflags)
register struct trap *trap; register struct trap *trap;
@@ -1044,7 +1077,11 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
} }
break; break;
} }
case LANDMINE: case LANDMINE: {
#ifdef STEED
unsigned steed_mid = 0;
struct obj *saddle;
#endif
if (Levitation || Flying) { if (Levitation || Flying) {
if (!already_seen && rn2(3)) break; if (!already_seen && rn2(3)) break;
seetrap(trap); seetrap(trap);
@@ -1072,22 +1109,28 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
pline("KAABLAMM!!! You triggered %s land mine!", pline("KAABLAMM!!! You triggered %s land mine!",
a_your[trap->madeby_u]); a_your[trap->madeby_u]);
#ifdef STEED #ifdef STEED
if (u.usteed) steed_mid = u.usteed->m_id;
recursive_mine = TRUE; recursive_mine = TRUE;
(void) steedintrap(trap, (struct obj *)0); (void) steedintrap(trap, (struct obj *)0);
recursive_mine = FALSE; recursive_mine = FALSE;
saddle = sobj_at(SADDLE,u.ux, u.uy);
#endif #endif
set_wounded_legs(LEFT_SIDE, rn1(35, 41)); set_wounded_legs(LEFT_SIDE, rn1(35, 41));
set_wounded_legs(RIGHT_SIDE, rn1(35, 41)); set_wounded_legs(RIGHT_SIDE, rn1(35, 41));
exercise(A_DEX, FALSE); exercise(A_DEX, FALSE);
} }
blow_up_landmine(trap); blow_up_landmine(trap);
#ifdef STEED
if (steed_mid && saddle && !u.usteed)
(void)keep_saddle_with_steedcorpse(steed_mid, fobj, saddle);
#endif
newsym(u.ux,u.uy); /* update trap symbol */ newsym(u.ux,u.uy); /* update trap symbol */
losehp(rnd(16), "land mine", KILLED_BY_AN); losehp(rnd(16), "land mine", KILLED_BY_AN);
/* fall recursively into the pit... */ /* fall recursively into the pit... */
if ((trap = t_at(u.ux, u.uy)) != 0) dotrap(trap, RECURSIVETRAP); if ((trap = t_at(u.ux, u.uy)) != 0) dotrap(trap, RECURSIVETRAP);
fill_pit(u.ux, u.uy); fill_pit(u.ux, u.uy);
break; break;
}
case ROLLING_BOULDER_TRAP: { case ROLLING_BOULDER_TRAP: {
int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0); int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0);