diff options
Diffstat (limited to 'crawl-ref/source/directn.cc')
-rw-r--r-- | crawl-ref/source/directn.cc | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 77ee90a963..5f06f3f977 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -467,6 +467,22 @@ static void _fill_monster_list(bool full_info) start = end; } } + +static int _mlist_letter_to_index(char idx) +{ + if (idx >= 'b') + idx--; + if (idx >= 'h') + idx--; + if (idx >= 'j') + idx--; + if (idx >= 'k') + idx--; + if (idx >= 'l') + idx--; + + return (idx - 'a'); +} #endif void direction(dist& moves, targeting_type restricts, @@ -483,7 +499,7 @@ void direction(dist& moves, targeting_type restricts, beh->just_looking = just_looking; #ifndef USE_TILE - if (!just_looking && may_target_monster && restricts != DIR_DIR + if (may_target_monster && restricts != DIR_DIR && Options.mlist_targetting == MLIST_TARGET_HIDDEN) { Options.mlist_targetting = MLIST_TARGET_ON; @@ -662,7 +678,8 @@ void direction(dist& moves, targeting_type restricts, if (key_command >= CMD_TARGET_CYCLE_MLIST && key_command <= CMD_TARGET_CYCLE_MLIST_END) { - const int idx = key_command - CMD_TARGET_CYCLE_MLIST; + const int idx = _mlist_letter_to_index(key_command + 'a' + - CMD_TARGET_CYCLE_MLIST); if (_find_square_wrapper(moves.tx, moves.ty, monsfind_pos, 1, _find_mlist, needs_path, idx, range, Options.target_wrap)) @@ -2710,18 +2727,21 @@ command_type targeting_behaviour::get_command(int key) if (key == -1) key = get_key(); + command_type cmd = key_to_command(key, KC_TARGETING); + if (cmd >= CMD_MIN_TARGET && cmd < CMD_TARGET_CYCLE_TARGET_MODE) + return (cmd); + #ifndef USE_TILE // Overrides the movement keys while mlist_targetting is active. if (Options.mlist_targetting == MLIST_TARGET_ON && islower(key)) return static_cast<command_type> (CMD_TARGET_CYCLE_MLIST + (key - 'a')); #endif - command_type cmd = key_to_command(key, KC_TARGETING); // XXX: hack if (cmd == CMD_TARGET_SELECT && key == ' ' && just_looking) cmd = CMD_TARGET_CANCEL; - return cmd; + return (cmd); } bool targeting_behaviour::should_redraw() |