From: nethack.allison Date: Sun, 13 Jul 2003 13:22:19 +0000 (+0000) Subject: B04003 - keep saddle with steed corpse if possible X-Git-Tag: MOVE2GIT~1901 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f8abb8c8ccacd655239d9fa12c80a57d68dd3555;p=nethack B04003 - keep saddle with steed corpse if possible --- diff --git a/doc/fixes34.2 b/doc/fixes34.2 index be0876ea0..3e2984c34 100644 --- a/doc/fixes34.2 +++ b/doc/fixes34.2 @@ -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 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 +try to keep saddle at the same location as the steed corpse Platform- and/or Interface-Specific Fixes diff --git a/src/trap.c b/src/trap.c index 501f8947a..4129cef57 100644 --- a/src/trap.c +++ b/src/trap.c @@ -26,6 +26,8 @@ STATIC_DCL int FDECL(mkroll_launch, STATIC_DCL boolean FDECL(isclearpath,(coord *, int, SCHAR_P, SCHAR_P)); #ifdef STEED STATIC_OVL int FDECL(steedintrap, (struct trap *, struct obj *)); +STATIC_OVL boolean FDECL(keep_saddle_with_steedcorpse, + (unsigned, struct obj *, struct obj *)); #endif #ifndef OVLB @@ -519,6 +521,37 @@ boolean shatter; 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 dotrap(trap, trflags) register struct trap *trap; @@ -1044,7 +1077,11 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst); } break; } - case LANDMINE: + case LANDMINE: { +#ifdef STEED + unsigned steed_mid = 0; + struct obj *saddle; +#endif if (Levitation || Flying) { if (!already_seen && rn2(3)) break; seetrap(trap); @@ -1072,22 +1109,28 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst); pline("KAABLAMM!!! You triggered %s land mine!", a_your[trap->madeby_u]); #ifdef STEED + if (u.usteed) steed_mid = u.usteed->m_id; recursive_mine = TRUE; (void) steedintrap(trap, (struct obj *)0); recursive_mine = FALSE; + saddle = sobj_at(SADDLE,u.ux, u.uy); #endif set_wounded_legs(LEFT_SIDE, rn1(35, 41)); set_wounded_legs(RIGHT_SIDE, rn1(35, 41)); exercise(A_DEX, FALSE); } 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 */ losehp(rnd(16), "land mine", KILLED_BY_AN); /* fall recursively into the pit... */ if ((trap = t_at(u.ux, u.uy)) != 0) dotrap(trap, RECURSIVETRAP); fill_pit(u.ux, u.uy); break; - + } case ROLLING_BOULDER_TRAP: { int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0);