mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 02:10:21 +08:00
feat: 清理 map 中的 png 类型截图
This commit is contained in:
@@ -711,6 +711,7 @@ bool asst::BattleHelper::check_and_use_skill(const Point& loc, bool& has_error,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void asst::BattleHelper::save_map(const cv::Mat& image)
|
||||
{
|
||||
LogTraceFunction;
|
||||
@@ -718,6 +719,21 @@ void asst::BattleHelper::save_map(const cv::Mat& image)
|
||||
using namespace asst::utils::path_literals;
|
||||
const auto& MapRelativeDir = "debug"_p / "map"_p;
|
||||
|
||||
// 清理旧的 PNG 文件
|
||||
static bool clean_png = true;
|
||||
if (clean_png) {
|
||||
for (const auto& entry : std::filesystem::directory_iterator(MapRelativeDir)) {
|
||||
if (entry.path().extension() == ".png") {
|
||||
std::error_code ec;
|
||||
std::filesystem::remove(entry.path(), ec);
|
||||
if (ec) {
|
||||
LogWarn << "Failed to remove png: " << entry.path() << ", " << ec.message();
|
||||
}
|
||||
}
|
||||
}
|
||||
clean_png = false;
|
||||
}
|
||||
|
||||
auto draw = image.clone();
|
||||
|
||||
for (const auto& [loc, info] : m_normal_tile_info) {
|
||||
|
||||
Reference in New Issue
Block a user