]> granicus.if.org Git - nethack/commitdiff
Prevent diagonal jump through open door
authorPasi Kallinen <paxed@alt.org>
Sat, 11 Jun 2016 16:27:50 +0000 (19:27 +0300)
committerPasi Kallinen <paxed@alt.org>
Sat, 11 Jun 2016 16:27:50 +0000 (19:27 +0300)
src/dothrow.c

index 2a70c8c35191f7fe95a29932adeb367bfd229f38..b8a3778b5eeefdea16fbc393aad801e68c5c804a 100644 (file)
@@ -544,9 +544,15 @@ int x, y;
     }
 
     if (!Passes_walls || !(may_pass = may_passwall(x, y))) {
-        if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)) {
+        boolean odoor_diag = (IS_DOOR(levl[x][y].typ)
+                              && (levl[x][y].doormask & D_ISOPEN)
+                              && (u.ux - x) && (u.uy - y));
+        if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)
+            || odoor_diag) {
             const char *s;
 
+            if (odoor_diag)
+                You("hit the door edge!");
             pline("Ouch!");
             if (IS_TREE(levl[x][y].typ))
                 s = "bumping into a tree";