diff options
-rw-r--r-- | crawl-ref/source/directn.cc | 56 | ||||
-rw-r--r-- | crawl-ref/source/enum.h | 9 | ||||
-rw-r--r-- | crawl-ref/source/initfile.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/options.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/output.cc | 3 | ||||
-rw-r--r-- | crawl-ref/source/state.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/state.h | 7 |
7 files changed, 34 insertions, 49 deletions
diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 8ae2a4851c..39e5fb1a3a 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -991,6 +991,19 @@ std::string _targ_mode_name(targ_mode_type mode) } } +bool _init_mlist() +{ + const int full_info = update_monster_pane(); + if (full_info != -1) + { + _fill_monster_list(full_info); + return (true); + } + else + return (false); +} + + void direction(dist& moves, const targetting_type restricts, targ_mode_type mode, const int range, const bool just_looking, const bool needs_path, const bool may_target_monster, @@ -1005,20 +1018,11 @@ void direction(dist& moves, const targetting_type restricts, beh->just_looking = just_looking; #ifndef USE_TILE + crawl_state.mlist_targetting = false; if (may_target_monster && restricts != DIR_DIR - && Options.mlist_targetting == MLIST_TARGET_HIDDEN) + && Options.mlist_targetting) { - Options.mlist_targetting = MLIST_TARGET_ON; - - const int full_info = update_monster_pane(); - if (full_info == -1) - { - // If there are no monsters after all, turn the the targetting - // off again. - Options.mlist_targetting = MLIST_TARGET_HIDDEN; - } - else - _fill_monster_list(full_info); + crawl_state.mlist_targetting = _init_mlist(); } #endif @@ -1285,22 +1289,11 @@ void direction(dist& moves, const targetting_type restricts, #ifndef USE_TILE case CMD_TARGET_TOGGLE_MLIST: - { - if (Options.mlist_targetting == MLIST_TARGET_ON) - Options.mlist_targetting = MLIST_TARGET_OFF; + if (!crawl_state.mlist_targetting) + crawl_state.mlist_targetting = _init_mlist(); else - Options.mlist_targetting = MLIST_TARGET_ON; - - const int full_info = update_monster_pane(); - if (Options.mlist_targetting == MLIST_TARGET_ON) - { - if (full_info == -1) - Options.mlist_targetting = MLIST_TARGET_HIDDEN; - else - _fill_monster_list(full_info); - } + crawl_state.mlist_targetting = false; break; - } #endif #ifdef WIZARD @@ -1435,10 +1428,6 @@ void direction(dist& moves, const targetting_type restricts, else you.prev_grd_targ = moves.target; -#ifndef USE_TILE - if (Options.mlist_targetting == MLIST_TARGET_ON) - Options.mlist_targetting = MLIST_TARGET_HIDDEN; -#endif break; case CMD_TARGET_OBJ_CYCLE_BACK: @@ -1488,11 +1477,6 @@ void direction(dist& moves, const targetting_type restricts, loop_done = true; moves.isCancel = true; beh->mark_ammo_nonchosen(); - -#ifndef USE_TILE - if (Options.mlist_targetting == MLIST_TARGET_ON) - Options.mlist_targetting = MLIST_TARGET_HIDDEN; -#endif break; case CMD_TARGET_CENTER: @@ -3585,7 +3569,7 @@ command_type targetting_behaviour::get_command(int key) #ifndef USE_TILE // Overrides the movement keys while mlist_targetting is active. - if (Options.mlist_targetting == MLIST_TARGET_ON && islower(key)) + if (crawl_state.mlist_targetting && islower(key)) return static_cast<command_type> (CMD_TARGET_CYCLE_MLIST + (key - 'a')); #endif diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index a521077906..c970478866 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -3167,15 +3167,6 @@ enum montravel_target_type MTRAV_KNOWN_UNREACHABLE // As above, and the player knows this. }; -#ifndef USE_TILE -enum mlist_targetting_type -{ - MLIST_TARGET_OFF = 0, - MLIST_TARGET_HIDDEN, - MLIST_TARGET_ON -}; -#endif - #ifdef USE_TILE enum screen_mode { diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index da5ecad62b..022b18caef 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -608,7 +608,7 @@ void game_options::reset_options() mlist_min_height = 5; msg_max_height = 10; mlist_allow_alternate_layout = false; - mlist_targetting = 0; + mlist_targetting = false; classic_hud = false; msg_condense_repeats = true; diff --git a/crawl-ref/source/options.h b/crawl-ref/source/options.h index 9d0bc6d3d6..e58d0cbe6e 100644 --- a/crawl-ref/source/options.h +++ b/crawl-ref/source/options.h @@ -60,7 +60,7 @@ public: int mlist_min_height; int msg_max_height; bool mlist_allow_alternate_layout; - int mlist_targetting; // not actually a real option + bool mlist_targetting; bool classic_hud; bool msg_condense_repeats; diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 99015569ea..ad90622cca 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -1387,8 +1387,7 @@ int update_monster_pane() if (i_print >= skip_lines && i_mons < (int) mons.size()) { _print_next_monster_desc(mons, i_mons, full_info, - Options.mlist_targetting == MLIST_TARGET_ON ? i_print - : -1); + crawl_state.mlist_targetting ? i_print : -1); } else cprintf("%s", blank.c_str()); diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc index 0c19d0513b..3a42af17f9 100644 --- a/crawl-ref/source/state.cc +++ b/crawl-ref/source/state.cc @@ -34,7 +34,11 @@ game_state::game_state() repeat_cmd(CMD_NO_CMD), cmd_repeat_count(0), cmd_repeat_goal(0), prev_repetition_turn(0), cmd_repeat_started_unsafe(false), input_line_curr(0), level_annotation_shown(false), +#ifndef USE_TILE + mlist_targetting(false), +#endif darken_range(-1) + { reset_cmd_repeat(); reset_cmd_again(); diff --git a/crawl-ref/source/state.h b/crawl-ref/source/state.h index 02af0a9190..387b0e8b33 100644 --- a/crawl-ref/source/state.h +++ b/crawl-ref/source/state.h @@ -80,6 +80,13 @@ struct game_state bool level_annotation_shown; +#ifndef USE_TILE + // Are we currently targetting using the mlist? + // This is global because the monster pane uses this when + // drawing. + bool mlist_targetting; +#endif + // Range beyond which view should be darkend, -1 == disabled. int darken_range; |