diff --git a/src/MaaCore/Task/Infrast/InfrastDormTask.cpp b/src/MaaCore/Task/Infrast/InfrastDormTask.cpp index 9b6d2ecdc0..882756452d 100644 --- a/src/MaaCore/Task/Infrast/InfrastDormTask.cpp +++ b/src/MaaCore/Task/Infrast/InfrastDormTask.cpp @@ -23,6 +23,12 @@ asst::InfrastDormTask& asst::InfrastDormTask::set_trust_enabled(bool dorm_trust_ return *this; } +bool asst::InfrastDormTask::on_run_fails() +{ + m_if_filter_notstationed_haspressed = false; + return asst::InfrastAbstractTask::on_run_fails(); +} + bool asst::InfrastDormTask::_run() { for (; m_cur_facility_index < m_max_num_of_dorm; ++m_cur_facility_index) { @@ -50,13 +56,10 @@ bool asst::InfrastDormTask::_run() } Log.trace("m_dorm_notstationed_enabled:", m_dorm_notstationed_enabled); - if (m_dorm_notstationed_enabled) { + if (m_dorm_notstationed_enabled && !m_if_filter_notstationed_haspressed) { Log.trace("click_filter_menu_not_stationed_button"); - // 在此处不进行 m_if_filter_notstationed_haspressed 的判断,即必须重新选择一次筛选条件 - if (click_filter_menu_not_stationed_button()) { - Log.info("successfully set filter to [Not Assigned]"); - m_if_filter_notstationed_haspressed = true; - } + click_filter_menu_not_stationed_button(); + m_if_filter_notstationed_haspressed = true; } if (!m_is_custom || current_room_config().autofill) { diff --git a/src/MaaCore/Task/Infrast/InfrastDormTask.h b/src/MaaCore/Task/Infrast/InfrastDormTask.h index 4903b17f1d..7d8e6390ec 100644 --- a/src/MaaCore/Task/Infrast/InfrastDormTask.h +++ b/src/MaaCore/Task/Infrast/InfrastDormTask.h @@ -14,6 +14,9 @@ public: InfrastDormTask& set_notstationed_enabled(bool dorm_notstationed_enabled) noexcept; InfrastDormTask& set_trust_enabled(bool m_dorm_trust_enabled) noexcept; +protected: + virtual bool on_run_fails() override; + private: virtual bool _run() override; // virtual bool click_confirm_button() override;