From: Pasi Kallinen Date: Tue, 17 Mar 2015 19:22:43 +0000 (+0200) Subject: More getpos improvements X-Git-Tag: NetHack-3.6.0_RC01~592 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=379c23096afdcf0bbe504604539b27004785f385;p=nethack More getpos improvements 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 --- diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 250b09d85..53a9d784e 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/src/do_name.c b/src/do_name.c index 37daffbc4..47012d3f3 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -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);