fix: tidy statics, instance, stretch43, fill/find_if ranges, NOLINT externs
This commit is contained in:
@@ -15,8 +15,10 @@
|
||||
// ni inline, així que no podem tornar-lo a incloure aquí. Ens fiem de les
|
||||
// declaracions extern dels símbols que ens calen (linkatge C++ normal,
|
||||
// igual que fa text.cpp).
|
||||
// NOLINTBEGIN(readability-identifier-naming) — símbols externs de gif.h.
|
||||
extern auto LoadGif(unsigned char* data, unsigned short* w, unsigned short* h) -> unsigned char*;
|
||||
extern auto LoadPalette(unsigned char* data) -> unsigned char*;
|
||||
// NOLINTEND(readability-identifier-naming)
|
||||
|
||||
namespace Resource {
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
namespace ResourceHelper {
|
||||
|
||||
namespace {
|
||||
ResourcePack pack_;
|
||||
bool pack_loaded_ = false;
|
||||
bool fallback_enabled_ = true;
|
||||
ResourcePack pack_obj;
|
||||
bool pack_loaded = false;
|
||||
bool fallback_enabled = true;
|
||||
|
||||
auto readFromDisk(const std::string& relative_path) -> std::vector<uint8_t> {
|
||||
const std::string FULL = std::string(Jf::getResourceFolder()) + relative_path;
|
||||
@@ -32,11 +32,11 @@ namespace ResourceHelper {
|
||||
} // namespace
|
||||
|
||||
auto initializeResourceSystem(const std::string& pack_file, bool enable_fallback) -> bool {
|
||||
fallback_enabled_ = enable_fallback;
|
||||
pack_loaded_ = pack_.loadPack(pack_file);
|
||||
fallback_enabled = enable_fallback;
|
||||
pack_loaded = pack_obj.loadPack(pack_file);
|
||||
|
||||
if (pack_loaded_) {
|
||||
std::cout << "ResourceHelper: pack loaded (" << pack_.getResourceCount()
|
||||
if (pack_loaded) {
|
||||
std::cout << "ResourceHelper: pack loaded (" << pack_obj.getResourceCount()
|
||||
<< " entries) from " << pack_file << '\n';
|
||||
} else if (enable_fallback) {
|
||||
std::cout << "ResourceHelper: no pack at " << pack_file
|
||||
@@ -50,22 +50,22 @@ namespace ResourceHelper {
|
||||
}
|
||||
|
||||
void shutdownResourceSystem() {
|
||||
pack_.clear();
|
||||
pack_loaded_ = false;
|
||||
pack_obj.clear();
|
||||
pack_loaded = false;
|
||||
}
|
||||
|
||||
auto loadFile(const std::string& relative_path) -> std::vector<uint8_t> {
|
||||
if (pack_loaded_ && pack_.hasResource(relative_path)) {
|
||||
return pack_.getResource(relative_path);
|
||||
if (pack_loaded && pack_obj.hasResource(relative_path)) {
|
||||
return pack_obj.getResource(relative_path);
|
||||
}
|
||||
if (fallback_enabled_) {
|
||||
if (fallback_enabled) {
|
||||
return readFromDisk(relative_path);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
auto hasPack() -> bool {
|
||||
return pack_loaded_;
|
||||
return pack_loaded;
|
||||
}
|
||||
|
||||
} // namespace ResourceHelper
|
||||
|
||||
Reference in New Issue
Block a user