diff --git a/src/MaaCore/Controller.cpp b/src/MaaCore/Controller.cpp index 0794e06a35..8bc416af11 100644 --- a/src/MaaCore/Controller.cpp +++ b/src/MaaCore/Controller.cpp @@ -412,7 +412,7 @@ std::optional asst::Controller::call_command(const std::string& cmd } if (is_reconnect_success) { if (call_and_hup_minitouch()) { - m_minitouch_avaiable = true; + m_minitouch_available = true; } auto recall_ret = call_command(cmd, timeout, false /* 禁止重连避免无限递归 */, recv_by_socket); if (recall_ret) { @@ -670,10 +670,10 @@ void asst::Controller::release_minitouch(bool force) { LogTraceFunction; - if (!m_minitouch_avaiable && !force) { + if (!m_minitouch_available && !force) { return; } - m_minitouch_avaiable = false; + m_minitouch_available = false; #ifdef _WIN32 @@ -783,7 +783,7 @@ void asst::Controller::clear_info() noexcept m_width = 0; m_height = 0; m_control_scale = 1.0; - m_minitouch_avaiable = false; + m_minitouch_available = false; m_scale_size = { WindowWidthDefault, WindowHeightDefault }; m_minitouch_props = decltype(m_minitouch_props)(); m_screencap_data_general_size = 0; @@ -1112,7 +1112,7 @@ bool asst::Controller::click_without_scale(const Point& p) Log.error("click point out of range"); } - if (m_minitouch_enabled && m_minitouch_avaiable) { + if (m_minitouch_enabled && m_minitouch_available) { Log.info("minitouch click:", p); Minitoucher toucher(std::bind(&Controller::input_to_minitouch, this, std::placeholders::_1), m_minitouch_props); return toucher.down(p.x, p.y) && toucher.up(); @@ -1162,7 +1162,7 @@ bool asst::Controller::swipe_without_scale(const Point& p1, const Point& p2, int } const auto& opt = Config.get_options(); - if (m_minitouch_enabled && m_minitouch_avaiable) { + if (m_minitouch_enabled && m_minitouch_available) { Log.info("minitouch swipe", p1, p2, duration, extra_swipe, slope_in, slope_out); Minitoucher toucher(std::bind(&Controller::input_to_minitouch, this, std::placeholders::_1), m_minitouch_props); toucher.down(x1, y1); @@ -1252,7 +1252,7 @@ bool asst::Controller::press_esc() bool asst::Controller::support_swipe_with_pause() const noexcept { - return m_minitouch_enabled && m_minitouch_avaiable && !m_adb.swipe.empty(); + return m_minitouch_enabled && m_minitouch_available && !m_adb.swipe.empty(); } bool asst::Controller::connect(const std::string& adb_path, const std::string& address, const std::string& config) @@ -1516,7 +1516,7 @@ bool asst::Controller::connect(const std::string& adb_path, const std::string& a } while (m_minitouch_enabled) { - m_minitouch_avaiable = false; + m_minitouch_available = false; std::string_view touch_program; if (m_use_maa_touch) { @@ -1562,13 +1562,13 @@ bool asst::Controller::connect(const std::string& adb_path, const std::string& a if (!call_and_hup_minitouch()) break; - m_minitouch_avaiable = true; + m_minitouch_available = true; break; }; - if (m_minitouch_enabled && !m_minitouch_avaiable) { + if (m_minitouch_enabled && !m_minitouch_available) { json::value info = get_info_json() | json::object { - { "what", "TouchModeNotAvaiable" }, + { "what", "TouchModeNotAvailable" }, { "why", "" }, }; callback(AsstMsg::ConnectionInfo, info); diff --git a/src/MaaCore/Controller.h b/src/MaaCore/Controller.h index a8b1901eb0..ee61ceb48b 100644 --- a/src/MaaCore/Controller.h +++ b/src/MaaCore/Controller.h @@ -162,7 +162,7 @@ namespace asst bool m_minitouch_enabled = true; // 开关 bool m_use_maa_touch = false; - bool m_minitouch_avaiable = false; // 状态 + bool m_minitouch_available = false; // 状态 #ifdef _WIN32 HANDLE m_minitouch_parent_write = INVALID_HANDLE_VALUE; diff --git a/src/MaaCore/Task/Fight/StageNavigationTask.cpp b/src/MaaCore/Task/Fight/StageNavigationTask.cpp index 06e00cf09f..2e6b7bb080 100644 --- a/src/MaaCore/Task/Fight/StageNavigationTask.cpp +++ b/src/MaaCore/Task/Fight/StageNavigationTask.cpp @@ -58,10 +58,10 @@ bool asst::StageNavigationTask::set_stage_name(const std::string& stage_name) } } - std::string upper_perfix = stage_prefix; - ranges::transform(upper_perfix, upper_perfix.begin(), + std::string upper_prefix = stage_prefix; + ranges::transform(upper_prefix, upper_prefix.begin(), [](char ch) -> char { return static_cast(::toupper(ch)); }); - m_stage_code = upper_perfix + chapter + "-" + stage_index; + m_stage_code = upper_prefix + chapter + "-" + stage_index; Log.info("stage code", m_stage_code); return true; diff --git a/src/MaaCore/Task/ReportDataTask.h b/src/MaaCore/Task/ReportDataTask.h index 505d551240..212922c6af 100644 --- a/src/MaaCore/Task/ReportDataTask.h +++ b/src/MaaCore/Task/ReportDataTask.h @@ -11,7 +11,7 @@ namespace asst { enum class ReportType { - Invaild, + Invalid, PenguinStats, YituliuBigData, }; @@ -49,7 +49,7 @@ namespace asst }, bool callback_on_failure = true); - ReportType m_report_type = ReportType::Invaild; + ReportType m_report_type = ReportType::Invalid; std::string m_body; std::string m_extra_param; std::vector> m_upload_pending; diff --git a/src/MaaCore/Task/Roguelike/RoguelikeBattleTaskPlugin.cpp b/src/MaaCore/Task/Roguelike/RoguelikeBattleTaskPlugin.cpp index 988ef38b10..2fdb19cafe 100644 --- a/src/MaaCore/Task/Roguelike/RoguelikeBattleTaskPlugin.cpp +++ b/src/MaaCore/Task/Roguelike/RoguelikeBattleTaskPlugin.cpp @@ -804,7 +804,7 @@ bool asst::RoguelikeBattleTaskPlugin::auto_battle() } m_is_cur_urgent = true; m_cur_home_index = m_next_urgent_index.top(); - Log.info("Enter urgent situtation"); + Log.info("Enter urgent situation"); m_next_urgent_index.pop(); } Log.info("To path", m_cur_home_index); diff --git a/src/MaaCore/Vision/Miscellaneous/BattleImageAnalyzer.cpp b/src/MaaCore/Vision/Miscellaneous/BattleImageAnalyzer.cpp index f31108ba9a..7de2432e70 100644 --- a/src/MaaCore/Vision/Miscellaneous/BattleImageAnalyzer.cpp +++ b/src/MaaCore/Vision/Miscellaneous/BattleImageAnalyzer.cpp @@ -262,14 +262,14 @@ int asst::BattleImageAnalyzer::oper_cost_analyze(const Rect& roi) auto [v_l, v_u] = std::dynamic_pointer_cast(Task.get("BattleOperCostChannelV"))->mask_range; range_lower = cv::Scalar(h_l, s_l, v_l); range_upper = cv::Scalar(h_u, s_u, v_u); - std::unordered_map num_hashs; + std::unordered_map num_hashes; for (auto&& num : NumName) { - auto hashs_vec = std::dynamic_pointer_cast(Task.get("BattleOperCost" + num))->hashes; - for (size_t i = 0; i != hashs_vec.size(); ++i) { - num_hashs.emplace(num + "_" + std::to_string(i), hashs_vec.at(i)); + auto hashes_vec = std::dynamic_pointer_cast(Task.get("BattleOperCost" + num))->hashes; + for (size_t i = 0; i != hashes_vec.size(); ++i) { + num_hashes.emplace(num + "_" + std::to_string(i), hashes_vec.at(i)); } } - hash_analyzer.set_hash_templates(std::move(num_hashs)); + hash_analyzer.set_hash_templates(std::move(num_hashes)); hash_analyzer.set_need_bound(true); hash_analyzer.set_need_split(true); inited = true; @@ -398,14 +398,14 @@ bool asst::BattleImageAnalyzer::hp_analyze() auto [v_l, v_u] = std::dynamic_pointer_cast(Task.get("BattleHpChannelV"))->mask_range; range_lower = cv::Scalar(h_l, s_l, v_l); range_upper = cv::Scalar(h_u, s_u, v_u); - std::unordered_map num_hashs; + std::unordered_map num_hashes; for (auto&& num : NumName) { - const auto& hashs_vec = std::dynamic_pointer_cast(Task.get("BattleHp" + num))->hashes; - for (size_t i = 0; i != hashs_vec.size(); ++i) { - num_hashs.emplace(num + "_" + std::to_string(i), hashs_vec.at(i)); + const auto& hashes_vec = std::dynamic_pointer_cast(Task.get("BattleHp" + num))->hashes; + for (size_t i = 0; i != hashes_vec.size(); ++i) { + num_hashes.emplace(num + "_" + std::to_string(i), hashes_vec.at(i)); } } - hash_analyzer.set_hash_templates(std::move(num_hashs)); + hash_analyzer.set_hash_templates(std::move(num_hashes)); hash_analyzer.set_need_bound(true); hash_analyzer.set_need_split(true); inited = true;