fix pull request #340 - untrap steed sanity
When a failed #untrap attempt while mounted caused hero to be moved
onto the trap, it neglected to set the steed's coordinates to match.
If 'sanity_check' was On, that would trigger warnings about steed's
anomalous position. Eventually a normal move would put steed's
coordinates back in sync with the hero's.
The pull request code set u.usteed->{mx,my} directly. I've used
u_on_newpos() instead. I also replaced some direct manipulations of
u.{ux,uy} with u_on_newpos() so that if clipping is in effect it will
be updated.
Fixes #340
This commit is contained in:
@@ -164,6 +164,8 @@ some monster code was checking whether pets or engulfers were eating green
|
|||||||
slime by checking for green slime corpse instead of glob
|
slime by checking for green slime corpse instead of glob
|
||||||
change light radius of stack of candles to square root
|
change light radius of stack of candles to square root
|
||||||
could get redundate "mon hits other-mon" messages when mon wields an artifact
|
could get redundate "mon hits other-mon" messages when mon wields an artifact
|
||||||
|
failed untrap while mounted that moved hero onto the trap would leave steed
|
||||||
|
with stale coordinates, triggering warnings if 'sanity_check' is On
|
||||||
|
|
||||||
|
|
||||||
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
|
||||||
|
|||||||
+10
-5
@@ -1416,8 +1416,8 @@ domove_core()
|
|||||||
}
|
}
|
||||||
if (u.uswallow) {
|
if (u.uswallow) {
|
||||||
u.dx = u.dy = 0;
|
u.dx = u.dy = 0;
|
||||||
u.ux = x = u.ustuck->mx;
|
x = u.ustuck->mx, y = u.ustuck->my;
|
||||||
u.uy = y = u.ustuck->my;
|
u_on_newpos(x, y); /* set u.ux,uy and handle CLIPPING */
|
||||||
mtmp = u.ustuck;
|
mtmp = u.ustuck;
|
||||||
} else {
|
} else {
|
||||||
if (Is_airlevel(&u.uz) && rn2(4) && !Levitation && !Flying) {
|
if (Is_airlevel(&u.uz) && rn2(4) && !Levitation && !Flying) {
|
||||||
@@ -1777,15 +1777,15 @@ domove_core()
|
|||||||
if (!in_out_region(x, y))
|
if (!in_out_region(x, y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* now move the hero */
|
|
||||||
mtmp = m_at(x, y);
|
mtmp = m_at(x, y);
|
||||||
|
/* tentaively move the hero plus steed; leave CLIPPING til later */
|
||||||
u.ux += u.dx;
|
u.ux += u.dx;
|
||||||
u.uy += u.dy;
|
u.uy += u.dy;
|
||||||
/* Move your steed, too */
|
|
||||||
if (u.usteed) {
|
if (u.usteed) {
|
||||||
u.usteed->mx = u.ux;
|
u.usteed->mx = u.ux;
|
||||||
u.usteed->my = u.uy;
|
u.usteed->my = u.uy;
|
||||||
exercise_steed();
|
/* [if move attempt ends up being blocked, should training count?] */
|
||||||
|
exercise_steed(); /* train riding skill */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1911,10 +1911,15 @@ domove_core()
|
|||||||
|
|
||||||
if (didnt_move) {
|
if (didnt_move) {
|
||||||
u.ux = u.ux0, u.uy = u.uy0; /* didn't move after all */
|
u.ux = u.ux0, u.uy = u.uy0; /* didn't move after all */
|
||||||
|
/* could skip this bit since we're about to call u_on_newpos() */
|
||||||
if (u.usteed)
|
if (u.usteed)
|
||||||
u.usteed->mx = u.ux, u.usteed->my = u.uy;
|
u.usteed->mx = u.ux, u.usteed->my = u.uy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* tentative move above didn't handle CLIPPING, in case there was a
|
||||||
|
monster in the way and the move attempt ended up being blocked;
|
||||||
|
do a full re-position now, possibly back to where hero started */
|
||||||
|
u_on_newpos(u.ux, u.uy);
|
||||||
|
|
||||||
reset_occupations();
|
reset_occupations();
|
||||||
if (g.context.run) {
|
if (g.context.run) {
|
||||||
|
|||||||
+2
-1
@@ -4035,7 +4035,8 @@ struct trap *ttmp;
|
|||||||
if (!Punished
|
if (!Punished
|
||||||
|| drag_ball(x, y, &bc, &bx, &by, &cx, &cy, &unused, TRUE)) {
|
|| drag_ball(x, y, &bc, &bx, &by, &cx, &cy, &unused, TRUE)) {
|
||||||
u.ux0 = u.ux, u.uy0 = u.uy;
|
u.ux0 = u.ux, u.uy0 = u.uy;
|
||||||
u.ux = x, u.uy = y;
|
/* set u.ux,u.uy and u.usteed->mx,my plus handle CLIPPING */
|
||||||
|
u_on_newpos(x, y);
|
||||||
u.umoved = TRUE;
|
u.umoved = TRUE;
|
||||||
newsym(u.ux0, u.uy0);
|
newsym(u.ux0, u.uy0);
|
||||||
vision_recalc(1);
|
vision_recalc(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user