]> granicus.if.org Git - nethack/commitdiff
fix grid bug travel bug
authorcohrs <cohrs>
Thu, 30 Dec 2010 21:47:06 +0000 (21:47 +0000)
committercohrs <cohrs>
Thu, 30 Dec 2010 21:47:06 +0000 (21:47 +0000)
From a bug report, grid bug could travel 1 step diagonally
due to special case code in findtravelpath that did not check grid bug
movement restriction

doc/fixes34.4
src/hack.c

index 6010d94be50e587e9ad1c03c33a7f7ea18816cfe..16f539ae1047abf38b0a145310bd38efc5b9067f 100644 (file)
@@ -392,6 +392,7 @@ writing while blind no longer possible for books, might fail for scrolls
 blanking items in pools while blind shouldn't reveal new obj description
        for ones which had been seen before becoming blind
 avoid infinite loop in topten output when killed by long-named monster
+grid bug could move diagonally 1 step using travel command
 
 
 Platform- and/or Interface-Specific Fixes
index 64635da0ebabf6a49028dfa4fe5c176b25f2d5cd..d86a39333d2974d21195f99130376d8fe60a248c 100644 (file)
@@ -789,7 +789,8 @@ findtravelpath(guess)
 boolean guess;
 {
     /* if travel to adjacent, reachable location, use normal movement rules */
-    if (!guess && context.travel1 && distmin(u.ux, u.uy, u.tx, u.ty) == 1) {
+    if (!guess && context.travel1 && distmin(u.ux, u.uy, u.tx, u.ty) == 1 &&
+       !(u.ux != u.tx && u.uy != u.ty && NODIAG(u.umonnum))) {
        context.run = 0;
        if (test_move(u.ux, u.uy, u.tx-u.ux, u.ty-u.uy, TEST_MOVE)) {
            u.dx = u.tx-u.ux;