style: aplicar fixes de clang-tidy (todo excepto uppercase-literal-suffix)
Corregidos ~2570 issues automáticamente con clang-tidy --fix-errors más ajustes manuales posteriores: - modernize: designated-initializers, trailing-return-type, use-auto, avoid-c-arrays (→ std::array<>), use-ranges, use-emplace, deprecated-headers, use-equals-default, pass-by-value, return-braced-init-list, use-default-member-init - readability: math-missing-parentheses, implicit-bool-conversion, braces-around-statements, isolate-declaration, use-std-min-max, identifier-naming, else-after-return, redundant-casting, convert-member-functions-to-static, make-member-function-const, static-accessed-through-instance - performance: avoid-endl, unnecessary-value-param, type-promotion, inefficient-vector-operation - dead code: XOR_KEY (orphan tras eliminar encryptData/decryptData), dead stores en engine.cpp y png_shape.cpp - NOLINT justificado en 10 funciones con alta complejidad cognitiva (initialize, render, main, processEvents, update×3, performDemoAction, randomizeOnDemoStart, renderDebugHUD, AppLogo::update) Compilación: gcc -Wall sin warnings. clang-tidy: 0 issues. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,51 +13,51 @@
|
||||
* único y ofuscado. Proporciona fallback automático a carpeta data/ si no existe pack.
|
||||
*/
|
||||
class ResourcePack {
|
||||
public:
|
||||
ResourcePack();
|
||||
~ResourcePack();
|
||||
public:
|
||||
ResourcePack();
|
||||
~ResourcePack();
|
||||
|
||||
// Empaquetado (usado por herramienta pack_resources)
|
||||
bool addDirectory(const std::string& dirPath, const std::string& prefix = "");
|
||||
bool savePack(const std::string& packFilePath);
|
||||
// Empaquetado (usado por herramienta pack_resources)
|
||||
bool addDirectory(const std::string& dir_path, const std::string& prefix = "");
|
||||
bool savePack(const std::string& pack_file_path);
|
||||
|
||||
// Desempaquetado (usado por el juego)
|
||||
bool loadPack(const std::string& packFilePath);
|
||||
// Desempaquetado (usado por el juego)
|
||||
bool loadPack(const std::string& pack_file_path);
|
||||
|
||||
// Carga de recursos individuales
|
||||
struct ResourceData {
|
||||
unsigned char* data;
|
||||
size_t size;
|
||||
};
|
||||
ResourceData loadResource(const std::string& resourcePath);
|
||||
// Carga de recursos individuales
|
||||
struct ResourceData {
|
||||
unsigned char* data;
|
||||
size_t size;
|
||||
};
|
||||
ResourceData loadResource(const std::string& resource_path);
|
||||
|
||||
// Utilidades
|
||||
std::vector<std::string> getResourceList() const;
|
||||
size_t getResourceCount() const;
|
||||
void clear();
|
||||
// Utilidades
|
||||
std::vector<std::string> getResourceList() const;
|
||||
size_t getResourceCount() const;
|
||||
void clear();
|
||||
|
||||
private:
|
||||
// Header del pack (12 bytes)
|
||||
struct PackHeader {
|
||||
char magic[4]; // "VBE3"
|
||||
uint32_t version; // Versión del formato (1)
|
||||
uint32_t fileCount; // Número de archivos empaquetados
|
||||
};
|
||||
private:
|
||||
// Header del pack (12 bytes)
|
||||
struct PackHeader {
|
||||
char magic[4]; // "VBE3"
|
||||
uint32_t version; // Versión del formato (1)
|
||||
uint32_t fileCount; // Número de archivos empaquetados
|
||||
};
|
||||
|
||||
// Índice de un recurso (variable length)
|
||||
struct ResourceEntry {
|
||||
std::string path; // Ruta relativa del recurso
|
||||
uint32_t offset; // Offset en el archivo pack
|
||||
uint32_t size; // Tamaño en bytes
|
||||
uint32_t checksum; // Checksum simple (XOR de bytes)
|
||||
};
|
||||
// Índice de un recurso (variable length)
|
||||
struct ResourceEntry {
|
||||
std::string path; // Ruta relativa del recurso
|
||||
uint32_t offset; // Offset en el archivo pack
|
||||
uint32_t size; // Tamaño en bytes
|
||||
uint32_t checksum; // Checksum simple (XOR de bytes)
|
||||
};
|
||||
|
||||
// Datos internos
|
||||
std::map<std::string, ResourceEntry> resources_;
|
||||
std::ifstream packFile_;
|
||||
bool isLoaded_;
|
||||
// Datos internos
|
||||
std::map<std::string, ResourceEntry> resources_;
|
||||
std::ifstream packFile_;
|
||||
bool isLoaded_;
|
||||
|
||||
// Funciones auxiliares
|
||||
uint32_t calculateChecksum(const unsigned char* data, size_t size);
|
||||
std::string normalizePath(const std::string& path);
|
||||
// Funciones auxiliares
|
||||
static uint32_t calculateChecksum(const unsigned char* data, size_t size);
|
||||
static std::string normalizePath(const std::string& path);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user