]> granicus.if.org Git - nethack/commitdiff
Valid cursor locations showed null
authorPasi Kallinen <paxed@alt.org>
Wed, 5 Dec 2018 20:39:11 +0000 (22:39 +0200)
committerPasi Kallinen <paxed@alt.org>
Wed, 5 Dec 2018 20:39:16 +0000 (22:39 +0200)
When getting a cursor location, and there was no "valid" location
function defined, trying to go to the next or previous valid
location showed null.

Fix this by using the "interesting" locations if no valid ones.

src/do_name.c

index c1210bbd95a0166d01dd7e925c00978cca76e840..38665135efeda6d304be4b01023e700399d06030 100644 (file)
@@ -378,6 +378,10 @@ int x, y, gloc;
                     || IS_UNEXPLORED_LOC(x - 1, y)
                     || IS_UNEXPLORED_LOC(x, y + 1)
                     || IS_UNEXPLORED_LOC(x, y - 1)));
+    case GLOC_VALID:
+        if (getpos_getvalid)
+            return (getpos_getvalid(x,y));
+        /*FALLTHRU*/
     case GLOC_INTERESTING:
         return gather_locs_interesting(x,y, GLOC_DOOR)
             || !(glyph_is_cmap(glyph)
@@ -395,8 +399,6 @@ int x, y, gloc;
                      || glyph_to_cmap(glyph) == S_darkroom
                      || glyph_to_cmap(glyph) == S_corr
                      || glyph_to_cmap(glyph) == S_litcorr));
-    case GLOC_VALID:
-        return (getpos_getvalid && getpos_getvalid(x,y));
     }
     /*NOTREACHED*/
     return FALSE;