]> granicus.if.org Git - nethack/commitdiff
B08012 - tweaking travel and closed doors
authorcohrs <cohrs>
Mon, 19 Aug 2002 17:10:34 +0000 (17:10 +0000)
committercohrs <cohrs>
Mon, 19 Aug 2002 17:10:34 +0000 (17:10 +0000)
- when testing travel locations, don't treat diagonal moves thru closed
doors as possible, unless player can go/dig thru door
- treat closed doors and boulders as expensive for travel, preferring open paths

src/hack.c

index 85c3811fdbc3e3ae27c8328823f5ed623d64af80..9afbb169b3251ec894c514418b63a21806783e6f 100644 (file)
@@ -600,19 +600,22 @@ int mode;
                            }
                        } else pline("That door is closed.");
                    }
-               }
-               if (mode != TEST_TRAV) return FALSE;
+               } else if (mode == TEST_TRAV) goto testdiag;
+               return FALSE;
            }
-       } else if (dx && dy && !Passes_walls
-                   && ((tmpr->doormask & ~D_BROKEN)
+       } else {
+       testdiag:
+           if (dx && dy && !Passes_walls
+               && ((tmpr->doormask & ~D_BROKEN)
 #ifdef REINCARNATION
-                                   || Is_rogue_level(&u.uz)
+                   || Is_rogue_level(&u.uz)
 #endif
-                                   || block_door(x,y))) {
-           /* Diagonal moves into a door are not allowed. */
-           if (Blind && mode == DO_MOVE)
-               feel_location(x,y);
-           return FALSE;
+                   || block_door(x,y))) {
+               /* Diagonal moves into a door are not allowed. */
+               if (Blind && mode == DO_MOVE)
+                   feel_location(x,y);
+               return FALSE;
+           }
        }
     }
     if (dx && dy
@@ -734,6 +737,18 @@ boolean guess;
                    int ny = y+ydir[ordered[dir]];
 
                    if (!isok(nx, ny)) continue;
+                   if ((!Passes_walls && !can_ooze(&youmonst) &&
+                       closed_door(x, y)) || sobj_at(BOULDER, x, y)) {
+                       /* closed doors and boulders usually
+                        * cause a delay, so prefer another path */
+                       if (travel[x][y] > radius-3) {
+                           travelstepx[1-set][nn] = x;
+                           travelstepy[1-set][nn] = y;
+                           /* don't change travel matrix! */
+                           nn++;
+                           continue;
+                       }
+                   }
                    if (test_move(x, y, nx-x, ny-y, TEST_TRAV) &&
                        (levl[nx][ny].seenv || (!Blind && couldsee(nx, ny)))) {
                        if (nx == ux && ny == uy) {