]> granicus.if.org Git - nethack/commitdiff
B04005 - leash and uncontrolled teleportation
authorcohrs <cohrs>
Sun, 14 Jul 2002 03:06:19 +0000 (03:06 +0000)
committercohrs <cohrs>
Sun, 14 Jul 2002 03:06:19 +0000 (03:06 +0000)
<Someone> reported that after an uncontrolled teleport due to eating a
leprechaun, his leashed pet was still leashed until he took one more step.
The usual approach which included disallowing the teleport seemed wrong in
this case, so I put in an abbreviated version that does its checks but does
not disallow the teleport.  The pet teleports with you in the same cases as
other teleports, but when it doesn't, the leash snaps loose.

doc/fixes34.1
src/allmain.c

index 49024180f4435bbfd94ec2f33799d9ca28cc6294..1ac07ca3934ec31a665a389fcb410e5aefd9f154 100644 (file)
@@ -163,6 +163,7 @@ avoid crash when drinking a potion causes the hero to float up over a fire
        trap, for example, which might try to destroy the in-use potion
 in some situations, if hero stood still, a hostile dwarf would switch back
        and forth between weapon and pick-axe and never move
+uncontrolled teleports did not handle leashed pets
 
 
 Platform- and/or Interface-Specific Fixes
index 9dc130c1d88a6c54679298674ca1f6369052fd7d..1c315841c7b58dce9c95956ab4885160d0f1afd1 100644 (file)
@@ -221,17 +221,18 @@ moveloop()
 
                    if(!u.uinvulnerable) {
                        if(Teleportation && !rn2(85)) {
-#ifdef REDO
                            xchar old_ux = u.ux, old_uy = u.uy;
-#endif
                            tele();
-#ifdef REDO
                            if (u.ux != old_ux || u.uy != old_uy) {
+                               if (!next_to_u()) {
+                                   check_leash(old_ux, old_uy);
+                               }
+#ifdef REDO
                                /* clear doagain keystrokes */
                                pushch(0);
                                savech(0);
-                           }
 #endif
+                           }
                        }
                        /* delayed change may not be valid anymore */
                        if ((change == 1 && !Polymorph) ||