]> granicus.if.org Git - nethack/commitdiff
Fix the "remove_object: obj not on floor" panic I encountered
authornethack.rankin <nethack.rankin>
Sat, 1 Jun 2002 10:32:55 +0000 (10:32 +0000)
committernethack.rankin <nethack.rankin>
Sat, 1 Jun 2002 10:32:55 +0000 (10:32 +0000)
when investigating the report of death due to falling off steed leaving
"you were riding" in the final attributes.  (This doesn't fix that bug.)
Dismounting calls teleds() to put the character on the map and teleds()
does various iron ball manipulations, but during level change the ball
is removed from the map and those manipulations won't work as intended.

doc/fixes34.1
src/do.c
src/teleport.c

index daf29b4fb2e0204283f8cd68e74a3a88b4c7726b..c8754baa1095117c9556e6ac4b86422745bfabe9 100644 (file)
@@ -112,6 +112,8 @@ under !GOLDOBJ, gold shouldn't disappear if you try to throw it at yourself
 under !GOLDOBJ, remove temp gold from inventory during restore
 Staff of Aesculapius did not always cure sliming
 correct singularization of fungi, liches, vortices
+prevent "remove_object: obj not on floor" panic for iron ball placement if
+       riding while punished leads to a fall off steed when changing levels
 
 
 Platform- and/or Interface-Specific Fixes
index cb14c445610f96b3d057faa900817c420a521314..db461f9462f577d92578ee2572edaaf24240d8a5 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)do.c       3.4     2001/11/29      */
+/*     SCCS Id: @(#)do.c       3.4     2002/05/31      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1120,13 +1120,13 @@ boolean at_stairs, falling, portal;
                            freeinv(uball);
                        }
                    }
-                   losehp(rnd(3), "falling downstairs", KILLED_BY);
 #ifdef STEED
-                   if (u.usteed) {
+                   /* falling off steed has its own losehp() call */
+                   if (u.usteed)
                        dismount_steed(DISMOUNT_FELL);
-                       if (Punished) unplacebc();
-                   }
+                   else
 #endif
+                       losehp(rnd(3), "falling downstairs", KILLED_BY);
                    selftouch("Falling, you");
                } else if (u.dz && at_ladder)
                    You("climb down the ladder.");
index ece66dc35841b917306d814185c69dce1c606b54..4b48ae7fa5f0f08d52d62916b2f6dde480bba735 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)teleport.c 3.4     2002/03/09      */
+/*     SCCS Id: @(#)teleport.c 3.4     2002/05/31      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -215,7 +215,8 @@ teleds(nux, nuy, allow_drag)
 register int nux,nuy;
 boolean allow_drag;
 {
-       boolean ball_still_in_range = FALSE;
+       boolean ball_active = (Punished && uball->where != OBJ_FREE),
+               ball_still_in_range = FALSE;
 
        /* If they have to move the ball, then drag if allow_drag is true;
         * otherwise they are teleporting, so unplacebc().  
@@ -232,7 +233,7 @@ boolean allow_drag;
         * dragging the ball is completely impossible (ball in range but there's
         * rock in the way), in which case it teleports the ball on its own.
         */
-       if (Punished) {
+       if (ball_active) {
            if (!carried(uball) && distmin(nux, nuy, uball->ox, uball->oy) <= 2)
                ball_still_in_range = TRUE; /* don't have to move the ball */
            else {
@@ -266,7 +267,7 @@ boolean allow_drag;
                u.uswldtim = u.uswallow = 0;
                docrt();
        }
-       if (Punished) {
+       if (ball_active) {
            if (ball_still_in_range || allow_drag) {
                int bc_control;
                xchar ballx, bally, chainx, chainy;
@@ -282,7 +283,7 @@ boolean allow_drag;
        u.ux = nux;
        u.uy = nuy;
        fill_pit(u.ux0, u.uy0);
-       if (Punished) {
+       if (ball_active) {
            if (!ball_still_in_range && !allow_drag)
                placebc();
        }