iron balls (R676)

Well, this proved rather annoying.  Problems included:
-- the solid rock problem that was noticed
-- teleporting to a spot two spaces away but on the other side of solid rock
could also leave the chain in solid rock
-- in one place I said chainx instead of ballx, which could cause problems with
teleporting
-- the teleport code moved the player before moving the ball, violating the
assumption that the player hasn't been moved yet (which only caused problems
after I added the solid rock fix).

Ball movement still isn't quite right, though the cases are really rare.  I
may fix them later.
This commit is contained in:
arromdee
2002-03-26 06:05:24 +00:00
parent 224eddc1d3
commit 9210d2c5ed
3 changed files with 88 additions and 15 deletions
+12 -5
View File
@@ -246,11 +246,18 @@ register int nux,nuy;
xchar ballx, bally, chainx, chainy;
boolean cause_delay;
/* this should only drag the chain (and never give a near-
capacity message) since we already checked ball distance */
(void) drag_ball(u.ux, u.uy, &bc_control, &ballx, &bally,
&chainx, &chainy, &cause_delay);
move_bc(0, bc_control, ballx, bally, chainx, chainy);
/* We really should only be dragging the chain here, since we
* checked the ball distance. However, some pathological
* cases will drag the ball anyway. drag_ball() tries to
* handle those by ignoring near_capacity() and teleporting the
* ball and chain along with you. Bug: if you only teleported
* one square, drag_ball() has no way to distinguish between
* teleporting and moving, and treats it like a move. (Note
* that teleds() doesn't imply teleporting.)
*/
if (drag_ball(u.ux, u.uy, &bc_control, &ballx, &bally,
&chainx, &chainy, &cause_delay))
move_bc(0, bc_control, ballx, bally, chainx, chainy);
} else
placebc();
}