probably fix teleport display bug (trunk only)

This might fix the following buglist entry
|Teleporting while using tiles may place you one tile beyond the edge of
|the display screen, and place the crosshair on empty space.

     Various bits of code, including teleport, are assigning directly to
u.ux,u.uy instead of calling u_on_newpos().  It wouldn't be an issue for
small tiles where the whole map fits on the screen, but it probably is for
bigger ones where clipping is in operation.  Using u_on_newpos() adjusts
the clipped map right away but changing u.ux,u.uy directly won't do so
until control returns to moveloop() and it eventually calls cliparound().
Usually the hero's position only changes by one column and/or row, hence
stays within the clipping margin, but that's not the case for teleport
nor for hurtling (throwing recoil while levitating, &c).

     Perhaps all the places that assign u.ux,uy should call u_on_newpos()
instead?  Most--all?--of them aren't updating u.usteed->mx,my, but I
guess that monster's coordinates don't matter since it isn't placed on
the map.
This commit is contained in:
nethack.rankin
2011-08-29 01:36:48 +00:00
parent 0acaa9bc1b
commit c7a867ec78
3 changed files with 4 additions and 11 deletions

View File

@@ -450,6 +450,8 @@ X11: fix typo in mouse click sanity check; result might have pointed to
unix/Qt: saved games were not found if nethack was built with prefixes in use
FreeBSD: compilation problems on FreeBSD 6.1
linux: compile support for TIOCGWINSZ by default
#if CLIPPING: during teleport or hurtle, re-clip the map immediately instead
of waiting until hero's next move
General New Features

View File

@@ -604,8 +604,7 @@ hurtle_step(arg, x, y)
ox = u.ux;
oy = u.uy;
u.ux = x;
u.uy = y;
u_on_newpos(x, y); /* set u.<ux,uy>, u.usteed-><mx,my>; cliparound(); */
newsym(ox, oy); /* update old position */
vision_recalc(1); /* update for new position */
flush_screen(1);

View File

@@ -303,8 +303,7 @@ boolean allow_drag;
}
/* must set u.ux, u.uy after drag_ball(), which may need to know
the old position if allow_drag is true... */
u.ux = nux;
u.uy = nuy;
u_on_newpos(nux, nuy); /* set u.<x,y>, usteed-><mx,my>; cliparound() */
fill_pit(u.ux0, u.uy0);
if (ball_active) {
if (!ball_still_in_range && !allow_drag)
@@ -312,13 +311,6 @@ boolean allow_drag;
}
initrack(); /* teleports mess up tracking monsters without this */
update_player_regions();
#ifdef STEED
/* Move your steed, too */
if (u.usteed) {
u.usteed->mx = nux;
u.usteed->my = nuy;
}
#endif
/*
* Make sure the hero disappears from the old location. This will
* not happen if she is teleported within sight of her previous