From eae4571a776e679b315f2f601f4d46fa4e35dff0 Mon Sep 17 00:00:00 2001 From: MistEO Date: Sun, 27 Nov 2022 03:15:51 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=B0=83=E6=95=B4=E4=B8=8B=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/Task/Fight/StageNavigationTask.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/MeoAssistant/Task/Fight/StageNavigationTask.cpp b/src/MeoAssistant/Task/Fight/StageNavigationTask.cpp index 69198efdd9..dbbaafefc5 100644 --- a/src/MeoAssistant/Task/Fight/StageNavigationTask.cpp +++ b/src/MeoAssistant/Task/Fight/StageNavigationTask.cpp @@ -21,17 +21,18 @@ bool asst::StageNavigationTask::set_stage_name(const std::string& stage_name) Log.error("directly task", m_directly_task); return true; } - m_is_directly = false; - // 10-1 -> [1] "", [2] "10", [3] "1", [4] "" - // JT8-2 -> [1] "JT", [2] "8", [3] "2", [4] "" - // 10-1-Hard -> [1] "", [2] "10", [3] "1", [4] "Hard" + static const std::regex StageRegex(R"(^([A-Za-z]{0,3})(\d{1,2})-(\d{1,2})(?:-(\w+))*$)"); std::smatch stage_sm; if (!std::regex_match(stage_name, stage_sm, StageRegex)) { - Log.error("Unknown stage", stage_name); + Log.error("The stage name is not in invalid, or is not main line stage", stage_name); return false; } + + // 10-1 -> [1] "", [2] "10", [3] "1", [4] "" + // JT8-2 -> [1] "JT", [2] "8", [3] "2", [4] "" + // H10-1-Hard -> [1] "H", [2] "10", [3] "1", [4] "Hard" const std::string& stage_prefix = stage_sm[1].str(); const std::string& chapter = stage_sm[2].str(); const std::string& stage_index = stage_sm[3].str();