treball en curs: correccions de tidy

This commit is contained in:
2026-05-16 17:45:32 +02:00
parent ee2dd0bc2c
commit 9f6d38cf48
22 changed files with 813 additions and 1074 deletions
+20 -10
View File
@@ -147,17 +147,27 @@ auto Asset::checkFile(const std::string &path) const -> bool {
// Devuelve el nombre del tipo de recurso
auto Asset::getTypeName(Type type) -> std::string {
switch (type) {
case Type::BITMAP: return "BITMAP";
case Type::MUSIC: return "MUSIC";
case Type::SOUND: return "SOUND";
case Type::FONT: return "FONT";
case Type::LANG: return "LANG";
case Type::DATA: return "DATA";
case Type::ROOM: return "ROOM";
case Type::ENEMY: return "ENEMY";
case Type::ITEM: return "ITEM";
case Type::BITMAP:
return "BITMAP";
case Type::MUSIC:
return "MUSIC";
case Type::SOUND:
return "SOUND";
case Type::FONT:
return "FONT";
case Type::LANG:
return "LANG";
case Type::DATA:
return "DATA";
case Type::ROOM:
return "ROOM";
case Type::ENEMY:
return "ENEMY";
case Type::ITEM:
return "ITEM";
case Type::COUNT:
default: return "ERROR";
default:
return "ERROR";
}
}
+7 -8
View File
@@ -9,14 +9,6 @@
class ResourcePack;
class ResourceLoader {
private:
static std::unique_ptr<ResourceLoader> instance;
ResourcePack* resource_pack_{nullptr};
std::string pack_path_;
bool fallback_to_files_{true};
ResourceLoader();
public:
static auto getInstance() -> ResourceLoader&;
~ResourceLoader();
@@ -34,6 +26,13 @@ class ResourceLoader {
[[nodiscard]] auto getAvailableResources() const -> std::vector<std::string>;
private:
ResourceLoader(); // Constructor privado (singleton)
static auto loadFromFile(const std::string& filename) -> std::vector<uint8_t>;
static auto getDataPath(const std::string& filename) -> std::string;
static std::unique_ptr<ResourceLoader> instance;
ResourcePack* resource_pack_{nullptr};
std::string pack_path_;
bool fallback_to_files_{true};
};
+9 -9
View File
@@ -14,15 +14,6 @@ struct ResourceEntry {
};
class ResourcePack {
private:
std::unordered_map<std::string, ResourceEntry> resources_;
std::vector<uint8_t> data_;
bool loaded_{false};
static auto calculateChecksum(const std::vector<uint8_t>& data) -> uint32_t;
static void encryptData(std::vector<uint8_t>& data, const std::string& key);
static void decryptData(std::vector<uint8_t>& data, const std::string& key);
public:
ResourcePack();
~ResourcePack();
@@ -41,4 +32,13 @@ class ResourcePack {
auto getResourceList() const -> std::vector<std::string>;
static const std::string DEFAULT_ENCRYPT_KEY;
private:
static auto calculateChecksum(const std::vector<uint8_t>& data) -> uint32_t;
static void encryptData(std::vector<uint8_t>& data, const std::string& key);
static void decryptData(std::vector<uint8_t>& data, const std::string& key);
std::unordered_map<std::string, ResourceEntry> resources_;
std::vector<uint8_t> data_;
bool loaded_{false};
};