From 47a35ba8a71e2f27956a58554c9217ec5b2bac5e Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Sat, 16 Jul 2022 12:32:45 -0400 Subject: [PATCH] Another getpos cmap followup Hot on the heels of my previous commit, here's a way to do it without any assumptions about the order of defsyms. --- src/do_name.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/do_name.c b/src/do_name.c index cc08994bf..95244e61d 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -926,12 +926,11 @@ getpos(coord *ccp, boolean force, const char *goal) int pass, lo_x, lo_y, hi_x, hi_y, k = 0; (void) memset((genericptr_t) matching, 0, sizeof matching); - /* start the loop one past the block of doors, walls, etc, - because we aren't interested in trying to match them */ - for (sidx = S_hcdoor + 1; sidx < MAXPCHARS; sidx++) { - /* some additional cmap types that should be skipped */ - if (sidx == S_room || sidx == S_darkroom - || sidx == S_corr || sidx == S_litcorr) + for (sidx = 0; sidx < MAXPCHARS; sidx++) { + /* don't even try to match some terrain: walls, room... */ + if (is_cmap_wall(sidx) || is_cmap_room(sidx) + || is_cmap_corr(sidx) || is_cmap_door(sidx) + || sidx == S_ndoor) continue; if (c == defsyms[sidx].sym || c == (int) g.showsyms[sidx]