mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 17:57:01 +08:00
Merge. Squash feature/drops
This commit is contained in:
@@ -6,13 +6,9 @@
|
||||
|
||||
#include "Logger.hpp"
|
||||
|
||||
void asst::TemplResource::append_load_required(std::unordered_set<std::string> required) noexcept
|
||||
void asst::TemplResource::set_load_required(std::unordered_set<std::string> required) noexcept
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
m_templs_filename.insert(
|
||||
std::make_move_iterator(required.begin()),
|
||||
std::make_move_iterator(required.end()));
|
||||
m_templs_filename = std::move(required);
|
||||
}
|
||||
|
||||
bool asst::TemplResource::load(const std::string& dir)
|
||||
@@ -20,16 +16,19 @@ bool asst::TemplResource::load(const std::string& dir)
|
||||
LogTraceFunction;
|
||||
|
||||
for (const std::string& filename : m_templs_filename) {
|
||||
std::string filepath = dir + "/" + filename;
|
||||
std::filesystem::path filepath(dir + "/" + filename);
|
||||
if (!filepath.has_extension()) {
|
||||
filepath.replace_extension(".png");
|
||||
}
|
||||
if (std::filesystem::exists(filepath)) {
|
||||
cv::Mat templ = cv::imread(filepath);
|
||||
cv::Mat templ = cv::imread(filepath.string());
|
||||
emplace_templ(filename, std::move(templ));
|
||||
}
|
||||
else if (m_loaded) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
m_last_error = filepath + " not exists";
|
||||
m_last_error = filepath.string() + " not exists";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user