From a8a7139746fecf2dbd9db7ede4e20f0f4241d67a Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 23 Sep 2022 11:25:33 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=9F=BA=E5=BB=BA?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E6=88=BF=E9=97=B4=E6=97=B6=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E4=BF=AE=E5=A4=8D=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=9F=BA=E5=BB=BA=E8=8F=B2=E4=BA=9A=E4=BB=BB=E5=8A=A1=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E5=90=8E=E9=9D=A2=E5=AE=BF=E8=88=8D=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/InfrastAbstractTask.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/MeoAssistant/InfrastAbstractTask.cpp b/src/MeoAssistant/InfrastAbstractTask.cpp index 5b70dc20f7..d31df11e64 100644 --- a/src/MeoAssistant/InfrastAbstractTask.cpp +++ b/src/MeoAssistant/InfrastAbstractTask.cpp @@ -94,28 +94,29 @@ bool asst::InfrastAbstractTask::on_run_fails() bool asst::InfrastAbstractTask::enter_facility(int index) { - const auto image = m_ctrler->get_image(); + LogTraceFunction; - InfrastFacilityImageAnalyzer analyzer(image); + if (m_is_custom && index >= m_custom_config.size()) { + Log.warn("index is lager than config size", index, m_custom_config.size()); + return false; + } + + InfrastFacilityImageAnalyzer analyzer(m_ctrler->get_image()); analyzer.set_to_be_analyzed({ facility_name() }); - if (!analyzer.analyze()) { - Log.trace("result is empty"); + Log.info("result is empty"); return false; } Rect rect = analyzer.get_rect(facility_name(), index); if (rect.empty()) { - Log.trace("facility index is out of range"); + Log.info("facility index is out of range"); return false; } - + m_ctrler->click(rect); m_cur_facility_index = index; callback(AsstMsg::SubTaskExtraInfo, basic_info_with_what("EnterFacility")); - - m_ctrler->click(rect); - const auto enter_task_ptr = Task.get("InfrastEnterFacility"); - sleep(enter_task_ptr->rear_delay); + sleep(Task.get("InfrastEnterFacility")->rear_delay); return true; }