]> granicus.if.org Git - nethack/commitdiff
probably fix teleport display bug (trunk only)
authornethack.rankin <nethack.rankin>
Mon, 29 Aug 2011 01:36:48 +0000 (01:36 +0000)
committernethack.rankin <nethack.rankin>
Mon, 29 Aug 2011 01:36:48 +0000 (01:36 +0000)
     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
src/dothrow.c
src/teleport.c

index b259db9e3e14656158a12a87287d29f193023326..ae92a2a22b0396cd65c9292d237a9630b2c55ee9 100644 (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
index 54bbeb6e8af8e163679ce3463413c94fffe1b945..cc94a5c2b90bfabea69590bc13703201423e8f4d 100644 (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);
index 67870a82077849e1cfd332734525d4217397600e..d32a3a7a4ea9542c09ced7d17df1f45601298fa5 100644 (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