]> granicus.if.org Git - nethack/commitdiff
More getpos improvements
authorPasi Kallinen <paxed@alt.org>
Tue, 17 Mar 2015 19:22:43 +0000 (21:22 +0200)
committerPasi Kallinen <paxed@alt.org>
Tue, 17 Mar 2015 19:29:54 +0000 (21:29 +0200)
Look up remembered dungeon features, not user-visible glyphs,
and ignore uninteresting features (room, corridor and wall tiles).

Original patch by Patric Mueller, from UnNetHack

doc/fixes35.0
src/do_name.c

index 250b09d8585d576cdbcc247962ac48f8c4dde73c..53a9d784ec89e263bb63bddac4012f05fd419c19 100644 (file)
@@ -1089,6 +1089,7 @@ change command X to twoweapon toggle
 pressing @ when cursor positioning moves cursor on top of hero
 pressing # when cursor positioning toggles automatic description of features
        under the cursor
+cursor positioning ignores uninteresting dungeon features
 
 
 Platform- and/or Interface-Specific New Features
index 37daffbc491696b391f8f5b3b900a3db72154b46..47012d3f3c190c511d9b16353c42469284b65314 100644 (file)
@@ -204,9 +204,25 @@ const char *goal;
                            lo_x = (pass == 0 && ty == lo_y) ? cx + 1 : 1;
                            hi_x = (pass == 1 && ty == hi_y) ? cx : COLNO - 1;
                            for (tx = lo_x; tx <= hi_x; tx++) {
-                               k = levl[tx][ty].glyph;
+                               /* look at dungeon feature, not at user-visible glyph */
+                               k = back_to_glyph(tx,ty);
+                               /* uninteresting background glyph */
                                if (glyph_is_cmap(k) &&
-                                       matching[glyph_to_cmap(k)]) {
+                                   (IS_DOOR(levl[tx][ty].typ) ||
+                                    glyph_to_cmap(k) == S_room ||
+                                    glyph_to_cmap(k) == S_corr ||
+                                    glyph_to_cmap(k) == S_litcorr)) {
+                                   /* what the hero remembers to be at tx,ty */
+                                   k = glyph_at(tx, ty);
+                               }
+                               if (glyph_is_cmap(k) &&
+                                       matching[glyph_to_cmap(k)] &&
+                                       levl[tx][ty].seenv &&
+                                       (!IS_WALL(levl[tx][ty].typ)) &&
+                                       (levl[tx][ty].typ != SDOOR) &&
+                                       glyph_to_cmap(k) != S_room &&
+                                       glyph_to_cmap(k) != S_corr &&
+                                       glyph_to_cmap(k) != S_litcorr) {
                                    cx = tx,  cy = ty;
                                    if (msg_given) {
                                        clear_nhwindow(WIN_MESSAGE);