diff --git a/src/MeoAssistant/Assistant.cpp b/src/MeoAssistant/Assistant.cpp index 42659b1595..e7ea52c718 100644 --- a/src/MeoAssistant/Assistant.cpp +++ b/src/MeoAssistant/Assistant.cpp @@ -33,7 +33,7 @@ Assistant::Assistant(AsstApiCallback callback, void* callback_arg) LogTraceFunction; m_status = std::make_shared(); - m_ctrler = std::make_shared(task_callback, (void*)this); + m_ctrler = std::make_shared(task_callback, static_cast(this)); m_working_thread = std::thread(&Assistant::working_proc, this); m_msg_thread = std::thread(&Assistant::msg_proc, this); @@ -85,31 +85,31 @@ asst::Assistant::TaskId asst::Assistant::append_task(const std::string& type, co std::shared_ptr ptr = nullptr; if (type == FightTask::TaskType) { - ptr = std::make_shared(task_callback, (void*)this); + ptr = std::make_shared(task_callback, static_cast(this)); } else if (type == StartUpTask::TaskType) { - ptr = std::make_shared(task_callback, (void*)this); + ptr = std::make_shared(task_callback, static_cast(this)); } else if (type == AwardTask::TaskType) { - ptr = std::make_shared(task_callback, (void*)this); + ptr = std::make_shared(task_callback, static_cast(this)); } else if (type == VisitTask::TaskType) { - ptr = std::make_shared(task_callback, (void*)this); + ptr = std::make_shared(task_callback, static_cast(this)); } else if (type == MallTask::TaskType) { - ptr = std::make_shared(task_callback, (void*)this); + ptr = std::make_shared(task_callback, static_cast(this)); } else if (type == InfrastTask::TaskType) { - ptr = std::make_shared(task_callback, (void*)this); + ptr = std::make_shared(task_callback, static_cast(this)); } else if (type == RecruitTask::TaskType) { - ptr = std::make_shared(task_callback, (void*)this); + ptr = std::make_shared(task_callback, static_cast(this)); } else if (type == RoguelikeTask::TaskType) { - ptr = std::make_shared(task_callback, (void*)this); + ptr = std::make_shared(task_callback, static_cast(this)); } else if (type == CopilotTask::TaskType) { - ptr = std::make_shared(task_callback, (void*)this); + ptr = std::make_shared(task_callback, static_cast(this)); } #ifdef ASST_DEBUG else if (type == DebugTask::TaskType) { @@ -293,7 +293,7 @@ void Assistant::msg_proc() void Assistant::task_callback(AsstMsg msg, const json::value& detail, void* custom_arg) { - Assistant* p_this = (Assistant*)custom_arg; + Assistant* p_this = static_cast(custom_arg); json::value more_detail = detail; more_detail["uuid"] = p_this->m_uuid; diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index 54dc422b5f..627cc9a863 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -781,7 +781,7 @@ int asst::Controller::swipe_without_scale(const Point& p1, const Point& p2, int extra_cmd = utils::string_replace_all(extra_cmd, "[y1]", std::to_string(p2.y)); int end_x = 0, end_y = 0; if (p2.x != p1.x) { - double k = (double)(p2.y - p1.y) / (p2.x - p1.x); + double k = static_cast(p2.y - p1.y) / (p2.x - p1.x); double temp = extra_swipe_dist / std::sqrt(1 + k * k); end_x = p2.x + static_cast((p2.x > p1.x ? -1.0 : 1.0) * temp); end_y = p2.y + static_cast((p2.y > p1.y ? -1.0 : 1.0) * std::fabs(k) * temp); diff --git a/src/MeoAssistant/OcrPack.cpp b/src/MeoAssistant/OcrPack.cpp index a4bdd73d7a..86da93c47d 100644 --- a/src/MeoAssistant/OcrPack.cpp +++ b/src/MeoAssistant/OcrPack.cpp @@ -89,10 +89,10 @@ std::vector asst::OcrPack::recognize(const cv::Mat image, const int* box = m_boxes_buffer + i * 8; int x_collect[4] = { *(box + 0), *(box + 2), *(box + 4), *(box + 6) }; int y_collect[4] = { *(box + 1), *(box + 3), *(box + 5), *(box + 7) }; - int left = int(*std::min_element(x_collect, x_collect + 4)); - int right = int(*std::max_element(x_collect, x_collect + 4)); - int top = int(*std::min_element(y_collect, y_collect + 4)); - int bottom = int(*std::max_element(y_collect, y_collect + 4)); + int left = static_cast(*std::min_element(x_collect, x_collect + 4)); + int right = static_cast(*std::max_element(x_collect, x_collect + 4)); + int top = static_cast(*std::min_element(y_collect, y_collect + 4)); + int bottom = static_cast(*std::max_element(y_collect, y_collect + 4)); rect = Rect(left, top, right - left, bottom - top); } std::string text(*(m_strs_buffer + i));