From aa41e20242e0f4c5ec29f613c91f8a2a82073cfc Mon Sep 17 00:00:00 2001 From: zzyyyl Date: Fri, 7 Oct 2022 18:54:15 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E7=AE=80=E5=8D=95=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Task/Plugin/RoguelikeBattleTaskPlugin.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/MeoAssistant/Task/Plugin/RoguelikeBattleTaskPlugin.cpp b/src/MeoAssistant/Task/Plugin/RoguelikeBattleTaskPlugin.cpp index 67c79f6a20..5927129250 100644 --- a/src/MeoAssistant/Task/Plugin/RoguelikeBattleTaskPlugin.cpp +++ b/src/MeoAssistant/Task/Plugin/RoguelikeBattleTaskPlugin.cpp @@ -140,15 +140,13 @@ bool asst::RoguelikeBattleTaskPlugin::get_stage_info() auto opt = RoguelikeCopilot.get_stage_data(m_stage_name); if (opt && !opt->replacement_home.empty()) { m_homes = opt->replacement_home; - std::string log_str = "[ "; - for (auto& home : m_homes) { - if (!m_normal_tile_info.contains(home.location)) { - Log.error("No replacement home point", home.location.x, home.location.y); - } - log_str += "( " + std::to_string(home.location.x) + ", " + std::to_string(home.location.y) + " ), "; + auto homes_pos = m_homes | views::transform(&ReplacementHome::location); + auto invalid_homes_pos = + homes_pos | views::filter([&](const auto& home_pos) { return !m_normal_tile_info.contains(home_pos); }); + if (!invalid_homes_pos.empty()) { + Log.error("No replacement homes point:", invalid_homes_pos); } - log_str += "]"; - Log.info("replacement home:", log_str); + Log.info("replacement home:", homes_pos); m_blacklist_location = opt->blacklist_location; m_stage_use_dice = opt->use_dice_stage; m_role_order = opt->role_order;