style: 修复 clang-format 14 导致的部分格式问题

This commit is contained in:
zzyyyl
2022-08-27 22:41:38 +08:00
parent 02ede7a336
commit 414507c0db
9 changed files with 25 additions and 31 deletions

View File

@@ -3,9 +3,9 @@
#include "AsstTypes.h"
#include "NoWarningCVMat.h"
//#ifndef ASST_DEBUG
//#define ASST_DEBUG
//#endif // ! ASST_DEBUG
// #ifndef ASST_DEBUG
// #define ASST_DEBUG
// #endif // ! ASST_DEBUG
namespace asst
{

View File

@@ -40,8 +40,8 @@ namespace asst
virtual AbstractTask& set_task_id(int task_id) noexcept;
template <typename PluginType>
std::shared_ptr<PluginType> register_plugin() requires
std::derived_from<PluginType, AbstractTaskPlugin> // Plugin must inherit AbstractTaskPlugin
std::shared_ptr<PluginType> register_plugin()
requires std::derived_from<PluginType, AbstractTaskPlugin> // Plugin must inherit AbstractTaskPlugin
{
auto plugin = std::make_shared<PluginType>(m_callback, m_callback_arg, m_task_chain);
m_plugins.emplace(plugin);

View File

@@ -72,18 +72,12 @@ namespace asst
{
return { value.x * scalar, value.y * scalar };
}
static int dot(const Point& lhs, const Point& rhs) noexcept
{
return (lhs.x * rhs.x) + (lhs.y * rhs.y);
}
static int dot(const Point& lhs, const Point& rhs) noexcept { return (lhs.x * rhs.x) + (lhs.y * rhs.y); }
static double distance(const Point& lhs, const Point& rhs) noexcept
{
return std::sqrt(std::pow(rhs.x - lhs.x, 2) + std::pow(rhs.y - lhs.y, 2));
}
double length() const noexcept
{
return std::sqrt(static_cast<double>(dot(*this, *this)));
}
double length() const noexcept { return std::sqrt(static_cast<double>(dot(*this, *this))); }
};
struct Rect

View File

@@ -56,9 +56,9 @@ namespace asst::utils
}
template <typename map_t>
inline std::string string_replace_all_batch(const std::string& src, const map_t& replace_pairs) requires
std::derived_from<typename map_t::value_type::first_type, std::string> &&
std::derived_from<typename map_t::value_type::second_type, std::string>
inline std::string string_replace_all_batch(const std::string& src, const map_t& replace_pairs)
requires std::derived_from<typename map_t::value_type::first_type, std::string> &&
std::derived_from<typename map_t::value_type::second_type, std::string>
{
std::string str = src;
for (const auto& [old_value, new_value] : replace_pairs) {

View File

@@ -4,7 +4,7 @@
#include "NoWarningCV.h"
//#include "RoguelikeSkillSelectionTaskPlugin.h"
// #include "RoguelikeSkillSelectionTaskPlugin.h"
#include "Logger.hpp"
#include "StageDropsImageAnalyzer.h"

View File

@@ -50,7 +50,7 @@ bool asst::InfrastDormTask::_run()
click_confirm_button();
click_return_button();
if (m_finished_stage == 3) { //不蹭信赖或所有干员满信赖
if (m_finished_stage == 3) { // 不蹭信赖或所有干员满信赖
break;
}
}
@@ -93,7 +93,7 @@ bool asst::InfrastDormTask::opers_choose()
if (m_trust_enabled && m_finished_stage > 0 && oper.selected == false &&
oper.doing != infrast::Doing::Working && oper.doing != infrast::Doing::Resting) {
//获得干员信赖值
// 获得干员信赖值
OcrWithPreprocessImageAnalyzer trust_analyzer(oper.name_img);
if (!trust_analyzer.analyze()) {
Log.trace("ERROR:!trust_analyzer.analyze():");
@@ -101,7 +101,7 @@ bool asst::InfrastDormTask::opers_choose()
}
std::string opertrust = trust_analyzer.get_result().front().text;
std::regex rule("[^0-9]"); //只保留数字
std::regex rule("[^0-9]"); // 只保留数字
opertrust = std::regex_replace(opertrust, rule, "");
Log.trace("opertrust:", opertrust);
@@ -113,13 +113,13 @@ bool asst::InfrastDormTask::opers_choose()
else if (opertrust != "" && atoi(opertrust.c_str()) >= 200) {
num_of_fulltrust++;
}
if (num_of_fulltrust >= 6) { //所有干员都满信赖了
if (num_of_fulltrust >= 6) { // 所有干员都满信赖了
m_finished_stage = 3;
Log.trace("num_of_fulltrust:", num_of_fulltrust, ", just return");
return true;
}
//获得干员所在设施
// 获得干员所在设施
OcrWithPreprocessImageAnalyzer facility_analyzer(oper.facility_img);
if (!facility_analyzer.analyze()) {
Log.trace("ERROR:!facility_analyzer.analyze():");
@@ -127,13 +127,13 @@ bool asst::InfrastDormTask::opers_choose()
}
std::string facilityname = facility_analyzer.get_result().front().text;
std::regex rule2("[^BF0-9]"); //只保留B、F和数字
std::regex rule2("[^BF0-9]"); // 只保留B、F和数字
facilityname = std::regex_replace(facilityname, rule2, "");
Log.trace("facilityname:<" + facilityname + ">");
bool if_oper_not_stationed = facilityname.length() < 4; //只有形如1F01或B101才是设施标签
bool if_oper_not_stationed = facilityname.length() < 4; // 只有形如1F01或B101才是设施标签
//判断要不要把人放进宿舍if_opertrust_not_full && if_oper_not_stationed
// 判断要不要把人放进宿舍if_opertrust_not_full && if_oper_not_stationed
if (if_opertrust_not_full && if_oper_not_stationed) {
Log.trace("put oper in");

View File

@@ -20,8 +20,8 @@ namespace asst
bool opers_choose();
bool m_notstationed_enabled = false; //设置是否启用未进驻筛选
bool m_trust_enabled = true; //设置是否启用蹭信赖
bool m_notstationed_enabled = false; // 设置是否启用未进驻筛选
bool m_trust_enabled = true; // 设置是否启用蹭信赖
int m_cur_dorm_index = 0;
int m_max_num_of_dorm = 4;

View File

@@ -1,6 +1,6 @@
#pragma once
//#include <any>
// #include <any>
#include <optional>
#include <string>
#include <unordered_map>

View File

@@ -27,8 +27,8 @@ namespace asst
template <typename TargetTaskInfoType>
requires std::derived_from<TargetTaskInfoType, TaskInfo> &&
(!std::same_as<TargetTaskInfoType, TaskInfo>) // Parameter must be a TaskInfo and not same as TaskInfo
std::shared_ptr<TargetTaskInfoType> get(const std::string& name)
(!std::same_as<TargetTaskInfoType, TaskInfo>) // Parameter must be a TaskInfo and not same as TaskInfo
std::shared_ptr<TargetTaskInfoType> get(const std::string& name)
{
auto it = m_all_tasks_info.find(name);
if (it == m_all_tasks_info.cend()) {
@@ -40,7 +40,7 @@ namespace asst
template <typename TargetTaskInfoType = TaskInfo>
requires std::same_as<TargetTaskInfoType, TaskInfo> // Parameter must be a TaskInfo
std::shared_ptr<TargetTaskInfoType> get(const std::string& name)
std::shared_ptr<TargetTaskInfoType> get(const std::string& name)
{
auto it = m_all_tasks_info.find(name);
if (it == m_all_tasks_info.cend()) {