From e9fb226dbf084b5bf0399dad67a24c16eb9c494f Mon Sep 17 00:00:00 2001 From: Michael Meyer Date: Sat, 16 Jul 2022 12:21:40 -0400 Subject: [PATCH] getpos cmap vs glyph followup This is a bit more efficient, since everything up to S_hcdoor is skipped anyway, but it's a little harder to understand so needs more comments. Not sure if it's worth it or not... --- src/do_name.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/do_name.c b/src/do_name.c index a6309edf4..cc08994bf 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -926,10 +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); - for (sidx = 1; sidx < MAXPCHARS; sidx++) { /* [0] left as 0 */ - /* don't even try to match some terrain: walls, room... */ - if (sidx <= S_hcdoor - || sidx == S_room || sidx == S_darkroom + /* 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) continue; if (c == defsyms[sidx].sym