From: nethack.rankin Date: Sat, 1 Jun 2002 10:32:55 +0000 (+0000) Subject: Fix the "remove_object: obj not on floor" panic I encountered X-Git-Tag: MOVE2GIT~2733 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac5975ea9dc7e42a171074591b45c7ec89af463d;p=nethack Fix the "remove_object: obj not on floor" panic I encountered 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. --- diff --git a/doc/fixes34.1 b/doc/fixes34.1 index daf29b4fb..c8754baa1 100644 --- a/doc/fixes34.1 +++ b/doc/fixes34.1 @@ -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 diff --git a/src/do.c b/src/do.c index cb14c4456..db461f946 100644 --- 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."); diff --git a/src/teleport.c b/src/teleport.c index ece66dc35..4b48ae7fa 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -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(); }