From c7a867ec78e4329bdce65d28d3cbce39481bf36d Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Mon, 29 Aug 2011 01:36:48 +0000 Subject: [PATCH] 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. --- doc/fixes34.4 | 2 ++ src/dothrow.c | 3 +-- src/teleport.c | 10 +--------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index b259db9e3..ae92a2a22 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/dothrow.c b/src/dothrow.c index 54bbeb6e8..cc94a5c2b 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -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., u.usteed->; cliparound(); */ newsym(ox, oy); /* update old position */ vision_recalc(1); /* update for new position */ flush_screen(1); diff --git a/src/teleport.c b/src/teleport.c index 67870a820..d32a3a7a4 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -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., usteed->; 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 -- 2.50.1