]> granicus.if.org Git - nethack/commitdiff
losing saddle while riding
authornethack.rankin <nethack.rankin>
Tue, 17 Apr 2007 03:43:17 +0000 (03:43 +0000)
committernethack.rankin <nethack.rankin>
Tue, 17 Apr 2007 03:43:17 +0000 (03:43 +0000)
     Noticed while looking at something else:  zapping a wand of opening
or spell of knock downwards while riding causes your steed's saddle to
fall off, which in turn causes the hero to fall and take some damage.
If that damage was fatal, the saddle would be left worn in bones data.
This reorganizes mdrop_obj() to defer until last the part that ultimately
makes the hero fall off, and changes bhitm() to call that instead of
handling saddle removal inline, also gives new saddle-off feedback there.

doc/fixes34.4
include/extern.h
src/steal.c
src/zap.c

index a87a86678dcdf3437148a6f92f5b4f38d2eedbc7..1eced6d874be423ae976ed904655523a84a53957 100644 (file)
@@ -346,6 +346,7 @@ make quest leader and nemesis be unlikely to be affected by traps
 use a more precise jumping path for far, non-straight line destinations
 increase damage bonus applies when kicking while polymorphed into a monster
        form which has a kicking attack, just like for other kicks
+if magically removing steed's saddle is fatal, don't leave it saddled in bones
 
 
 Platform- and/or Interface-Specific Fixes
index 2f595fb994f2f769402ddc39555392d36f9c58c3..af63b95039caa5caaa51c494a617ff2243a39ea4 100644 (file)
@@ -2128,6 +2128,7 @@ E void FDECL(remove_worn_item, (struct obj *,BOOLEAN_P));
 E int FDECL(steal, (struct monst *, char *));
 E int FDECL(mpickobj, (struct monst *,struct obj *));
 E void FDECL(stealamulet, (struct monst *));
+E void FDECL(mdrop_obj, (struct monst *,struct obj *,BOOLEAN_P));
 E void FDECL(mdrop_special_objs, (struct monst *));
 E void FDECL(relobj, (struct monst *,int,BOOLEAN_P));
 #ifdef GOLDOBJ
index 3d9c298c1f79cafe6bda9d11b1340c25369b385f..693b5249da37e1eaf7b3504bdc0053db6e6e5aa5 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)steal.c    3.5     2006/06/25      */
+/*     SCCS Id: @(#)steal.c    3.5     2007/04/16      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -7,7 +7,6 @@
 STATIC_PTR int NDECL(stealarm);
 
 STATIC_DCL const char *FDECL(equipname, (struct obj *));
-STATIC_DCL void FDECL(mdrop_obj, (struct monst *,struct obj *,BOOLEAN_P));
 
 STATIC_OVL const char *
 equipname(otmp)
@@ -554,19 +553,20 @@ struct monst *mtmp;
 }
 
 /* drop one object taken from a (possibly dead) monster's inventory */
-STATIC_OVL void
+void
 mdrop_obj(mon, obj, verbosely)
 struct monst *mon;
 struct obj *obj;
 boolean verbosely;
 {
     int omx = mon->mx, omy = mon->my;
+    boolean update_mon = FALSE;
 
     if (obj->owornmask) {
        /* perform worn item handling if the monster is still alive */
        if (mon->mhp > 0) {
            mon->misc_worn_check &= ~obj->owornmask;
-           update_mon_intrinsics(mon, obj, FALSE, TRUE);
+           update_mon = TRUE;
 #ifdef STEED
        /* don't charge for an owned saddle on dead steed */
        } else if (mon->mtame && (obj->owornmask & W_SADDLE) && 
@@ -585,6 +585,9 @@ boolean verbosely;
        place_object(obj, omx, omy);
        stackobj(obj);
     }
+    /* do this last, after placing obj on floor; removing steed's saddle
+       throws rider, possibly inflicting fatal damage and producing bones */
+    if (update_mon) update_mon_intrinsics(mon, obj, FALSE, TRUE);
 }
 
 /* some monsters bypass the normal rules for moving between levels or
index 2f75f28591fe49b68b906acbfaa91bbb625053cf..eeee7713ee42c72e997629e81186490600d0825a 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -299,14 +299,21 @@ struct obj *otmp;
                        break;
 #ifdef STEED
                } else if ((obj = which_armor(mtmp, W_SADDLE)) != 0) {
-                       mtmp->misc_worn_check &= ~obj->owornmask;
-                       update_mon_intrinsics(mtmp, obj, FALSE, FALSE);
-                       obj->owornmask = 0L;
+                       char buf[BUFSZ];
+
+                       Sprintf(buf, "%s %s", s_suffix(Monnam(mtmp)),
+                               distant_name(obj, xname));
+                       if (cansee(mtmp->mx, mtmp->my)) {
+                           if (!canspotmon(mtmp))
+                               Strcpy(buf, An(distant_name(obj, xname)));
+                           pline("%s falls to the %s.",
+                                 buf, surface(mtmp->mx, mtmp->my));
+                       } else if (canspotmon(mtmp)) {
+                           pline("%s falls off.", buf);
+                       }
                        obj_extract_self(obj);
-                       place_object(obj, mtmp->mx, mtmp->my);
-                       /* call stackobj() if we ever drop anything that can merge */
-                       newsym(mtmp->mx, mtmp->my);
-#endif
+                       mdrop_obj(mtmp, obj, FALSE);
+#endif /* STEED */
                }
                break;
        case SPE_HEALING: