fix: build warnings on macOS

This commit is contained in:
MistEO
2022-12-26 02:02:02 +08:00
parent 8cf9aac17b
commit c266eb1b4c
5 changed files with 17 additions and 17 deletions

View File

@@ -95,7 +95,7 @@ bool asst::RoguelikeCopilotConfig::parse(const json::value& json)
auto roles = raw_roles | filter(&json::value::is_string) | transform(&json::value::as_string) |
transform([&](std::string name) {
utils::tolowers(name);
return std::move(name);
return name;
});
for (const std::string& role_name : roles) {
const auto role = get_role_type(role_name);

View File

@@ -530,8 +530,11 @@ bool asst::Controller::call_and_hup_minitouch()
pipe_parent_read = INVALID_HANDLE_VALUE;
m_minitouch_parent_write = pipe_parent_write;
#else // !_WIN32
std::ignore = PipeWriteBuffSize;
int pipe_to_child[2];
int pipe_from_child[2];
@@ -1595,12 +1598,12 @@ bool asst::Controller::connect(const std::string& adb_path, const std::string& a
return true;
}
bool asst::Controller::make_instance_inited(bool inited)
void asst::Controller::make_instance_inited(bool inited)
{
Log.trace(__FUNCTION__, "|", inited, ", pre m_inited =", m_inited, ", pre m_instance_count =", m_instance_count);
if (inited == m_inited) {
return true;
return;
}
m_inited = inited;
@@ -1610,10 +1613,9 @@ bool asst::Controller::make_instance_inited(bool inited)
else {
// 所有实例全部释放,执行最终的 release 函数
if (!--m_instance_count) {
return release();
release();
}
}
return true;
}
void asst::Controller::kill_adb_daemon()
@@ -1630,7 +1632,7 @@ void asst::Controller::kill_adb_daemon()
}
}
bool asst::Controller::release()
void asst::Controller::release()
{
close_socket();
@@ -1638,12 +1640,9 @@ bool asst::Controller::release()
if (m_child)
#endif
{
if (m_adb.release.empty()) {
return true;
}
else {
if (!m_adb.release.empty()) {
m_adb_release.clear();
return call_command(m_adb.release, 20000, false).has_value();
call_command(m_adb.release, 20000, false);
}
}
}

View File

@@ -72,9 +72,9 @@ namespace asst
private:
std::optional<std::string> call_command(const std::string& cmd, int64_t timeout = 20000,
bool allow_reconnect = true, bool recv_by_socket = false);
bool release();
void release();
void kill_adb_daemon();
bool make_instance_inited(bool inited);
void make_instance_inited(bool inited);
void close_socket() noexcept;
std::optional<unsigned short> init_socket(const std::string& local_address);
@@ -243,7 +243,8 @@ namespace asst
{
return m_input_func(up_cmd(wait_ms, with_commit, contact));
}
bool key_down(int key_code, int wait_ms = DefaultClickDelay, bool with_commit = true) {
bool key_down(int key_code, int wait_ms = DefaultClickDelay, bool with_commit = true)
{
return m_input_func(key_down_cmd(key_code, wait_ms, with_commit));
}
bool key_up(int key_code, int wait_ms = DefaultClickDelay, bool with_commit = true)
@@ -300,7 +301,8 @@ namespace asst
return str;
}
[[nodiscard]] std::string key_down_cmd(int key_code, int wait_ms = DefaultClickDelay, bool with_commit = true)
[[nodiscard]] std::string key_down_cmd(int key_code, int wait_ms = DefaultClickDelay,
bool with_commit = true)
{
char buff[64] = { 0 };
sprintf(buff, "k %d d\n", key_code);

View File

@@ -24,7 +24,6 @@ namespace asst
bool m_dorm_notstationed_enabled = false; // 设置是否启用未进驻筛选
bool m_drom_trust_enabled = true; // 设置是否启用蹭信赖
int m_cur_dorm_index = 0;
int m_max_num_of_dorm = 4;
enum class NextStep

View File

@@ -23,8 +23,8 @@ namespace asst
protected:
std::shared_ptr<ProcessTask> m_start_up_task_ptr = nullptr;
std::shared_ptr<ProcessTask> m_fight_task_ptr = nullptr;
std::shared_ptr<StageNavigationTask> m_stage_navigation_task_ptr = nullptr;
std::shared_ptr<ProcessTask> m_fight_task_ptr = nullptr;
std::shared_ptr<StageDropsTaskPlugin> m_stage_drops_plugin_ptr = nullptr;
std::shared_ptr<GameCrashRestartTaskPlugin> m_game_restart_plugin_ptr = nullptr;
std::shared_ptr<DrGrandetTaskPlugin> m_dr_grandet_task_plugin_ptr = nullptr;