fix a panic and infinite recursion

Changes to be committed:
	modified:   src/ball.c
	modified:   src/display.c
	modified:   src/mon.c
This commit is contained in:
nhmall
2015-04-29 23:53:31 -04:00
parent 97a5bdfb17
commit fcfab90907
3 changed files with 23 additions and 8 deletions
+15 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 ball.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 ball.c $NHDT-Date: 1430365884 2015/04/30 03:51:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.22 $ */
/* NetHack 3.5 ball.c $Date: 2011/08/30 22:13:26 $ $Revision: 1.17 $ */ /* NetHack 3.5 ball.c $Date: 2011/08/30 22:13:26 $ $Revision: 1.17 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -102,7 +102,7 @@ ballfall()
* It is assumed that when this is called, the ball and chain are NOT * It is assumed that when this is called, the ball and chain are NOT
* attached to the object list. * attached to the object list.
* *
* Should not be called while swallowed. * Should not be called while swallowed except on waterlevel.
*/ */
void void
placebc() placebc()
@@ -112,14 +112,12 @@ placebc()
return; return;
} }
obj_extract_self(uchain);
(void) flooreffects(uchain, u.ux, u.uy, ""); /* chain might rust */ (void) flooreffects(uchain, u.ux, u.uy, ""); /* chain might rust */
if (carried(uball)) /* the ball is carried */ if (carried(uball)) /* the ball is carried */
u.bc_order = BCPOS_DIFFER; u.bc_order = BCPOS_DIFFER;
else { else {
/* ball might rust -- already checked when carried */ /* ball might rust -- already checked when carried */
obj_extract_self(uball);
(void) flooreffects(uball, u.ux, u.uy, ""); (void) flooreffects(uball, u.ux, u.uy, "");
place_object(uball, u.ux, u.uy); place_object(uball, u.ux, u.uy);
u.bc_order = BCPOS_CHAIN; u.bc_order = BCPOS_CHAIN;
@@ -135,7 +133,19 @@ placebc()
void void
unplacebc() unplacebc()
{ {
if (u.uswallow) return; /* ball&chain not placed while swallowed */ if (u.uswallow) {
if (Is_waterlevel(&u.uz)) {
/* we need to proceed with the removal from the floor
* so that movebubbles() processing will disregard it as
* intended. Ignore all the vision stuff.
*/
if (!carried(uball))
obj_extract_self(uball);
obj_extract_self(uchain);
}
/* ball&chain not unplaced while swallowed */
return;
}
if (!carried(uball)) { if (!carried(uball)) {
obj_extract_self(uball); obj_extract_self(uball);
+6 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 display.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ /* NetHack 3.5 display.c $NHDT-Date: 1430365890 2015/04/30 03:51:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.49 $ */
/* NetHack 3.5 display.c $Date: 2011/12/05 03:17:36 $ $Revision: 1.34 $ */ /* NetHack 3.5 display.c $Date: 2011/12/05 03:17:36 $ $Revision: 1.34 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */ /* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */ /* and Dave Cohrs, 1990. */
@@ -1363,11 +1363,16 @@ row_refresh(start,stop,y)
void void
cls() cls()
{ {
static boolean in_cls = 0;
if (in_cls) return;
in_cls = TRUE;
display_nhwindow(WIN_MESSAGE, FALSE); /* flush messages */ display_nhwindow(WIN_MESSAGE, FALSE); /* flush messages */
context.botlx = 1; /* force update of botl window */ context.botlx = 1; /* force update of botl window */
clear_nhwindow(WIN_MAP); /* clear physical screen */ clear_nhwindow(WIN_MAP); /* clear physical screen */
clear_glyph_buffer(); /* this is sort of an extra effort, but OK */ clear_glyph_buffer(); /* this is sort of an extra effort, but OK */
in_cls = FALSE;
} }
/* /*
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 mon.c $NHDT-Date: 1429666918 2015/04/22 01:41:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.165 $ */ /* NetHack 3.5 mon.c $NHDT-Date: 1430365894 2015/04/30 03:51:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.168 $ */
/* NetHack 3.5 mon.c $Date: 2012/05/16 02:15:10 $ $Revision: 1.126 $ */ /* NetHack 3.5 mon.c $Date: 2012/05/16 02:15:10 $ $Revision: 1.126 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1850,7 +1850,7 @@ register struct monst *mtmp;
u.uy = mtmp->my; u.uy = mtmp->my;
u.uswallow = 0; u.uswallow = 0;
u.uswldtim = 0; u.uswldtim = 0;
if (Punished) placebc(); if (BALL_IN_MON) placebc();
vision_full_recalc = 1; vision_full_recalc = 1;
docrt(); docrt();
} }