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.
This commit is contained in:
nethack.rankin
2002-06-01 10:32:55 +00:00
parent a99a8fcba8
commit ac5975ea9d
3 changed files with 13 additions and 10 deletions

View 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

View File

@@ -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.");

View 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();
}