From 9b1f0899b0846bae689fea380e94c610ba304340 Mon Sep 17 00:00:00 2001 From: cohrs Date: Thu, 30 Dec 2010 21:47:06 +0000 Subject: [PATCH] fix grid bug travel bug 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 | 1 + src/hack.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 6010d94be..16f539ae1 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 diff --git a/src/hack.c b/src/hack.c index 64635da0e..d86a39333 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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; -- 2.40.0