forked from jaildesigner-jailgames/jaildoctors_dilemma
linter
This commit is contained in:
@@ -223,7 +223,7 @@ auto Asset::check() const -> bool {
|
||||
}
|
||||
|
||||
// Comprueba que existe un fichero
|
||||
auto Asset::checkFile(const std::string& path) const -> bool {
|
||||
auto Asset::checkFile(const std::string& path) -> bool {
|
||||
std::ifstream file(path);
|
||||
bool success = file.good();
|
||||
file.close();
|
||||
|
||||
@@ -58,7 +58,7 @@ class Asset {
|
||||
std::string executable_path_; // Ruta del ejecutable
|
||||
|
||||
// --- Métodos internos ---
|
||||
[[nodiscard]] auto checkFile(const std::string& path) const -> bool; // Verifica si un archivo existe
|
||||
[[nodiscard]] static auto checkFile(const std::string& path) -> bool; // Verifica si un archivo existe
|
||||
[[nodiscard]] static auto getTypeName(Type type) -> std::string; // Obtiene el nombre del tipo
|
||||
[[nodiscard]] static auto parseAssetType(const std::string& type_str) -> Type; // Convierte string a tipo
|
||||
void addToMap(const std::string& file_path, Type type, bool required, bool absolute); // Añade archivo al mapa
|
||||
|
||||
@@ -198,7 +198,7 @@ void Resource::loadSounds() {
|
||||
JA_Sound_t* sound = nullptr;
|
||||
|
||||
// Try loading from resource pack first
|
||||
auto audio_data = jdd::ResourceHelper::loadFile(l);
|
||||
auto audio_data = Jdd::ResourceHelper::loadFile(l);
|
||||
if (!audio_data.empty()) {
|
||||
sound = JA_LoadSound(audio_data.data(), static_cast<Uint32>(audio_data.size()));
|
||||
}
|
||||
@@ -225,7 +225,7 @@ void Resource::loadMusics() {
|
||||
JA_Music_t* music = nullptr;
|
||||
|
||||
// Try loading from resource pack first
|
||||
auto audio_data = jdd::ResourceHelper::loadFile(l);
|
||||
auto audio_data = Jdd::ResourceHelper::loadFile(l);
|
||||
if (!audio_data.empty()) {
|
||||
music = JA_LoadMusic(audio_data.data(), static_cast<Uint32>(audio_data.size()));
|
||||
}
|
||||
@@ -415,8 +415,8 @@ void Resource::renderProgress() {
|
||||
Screen::get()->clearSurface(static_cast<Uint8>(PaletteColor::BLACK));
|
||||
|
||||
auto surface = Screen::get()->getRendererSurface();
|
||||
const Uint8 TEXT_COLOR = static_cast<Uint8>(PaletteColor::BRIGHT_WHITE);
|
||||
const Uint8 BAR_COLOR = static_cast<Uint8>(PaletteColor::WHITE);
|
||||
const auto TEXT_COLOR = static_cast<Uint8>(PaletteColor::BRIGHT_WHITE);
|
||||
const auto BAR_COLOR = static_cast<Uint8>(PaletteColor::WHITE);
|
||||
const int TEXT_HEIGHT = loading_text_->getCharacterSize();
|
||||
const int CENTER_X = Options::game.width / 2;
|
||||
const int CENTER_Y = Options::game.height / 2;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "resource_loader.hpp"
|
||||
|
||||
namespace jdd {
|
||||
namespace Jdd {
|
||||
namespace ResourceHelper {
|
||||
|
||||
static bool resource_system_initialized = false;
|
||||
@@ -175,4 +175,4 @@ auto isPackLoaded() -> bool {
|
||||
}
|
||||
|
||||
} // namespace ResourceHelper
|
||||
} // namespace jdd
|
||||
} // namespace Jdd
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace jdd {
|
||||
namespace Jdd {
|
||||
namespace ResourceHelper {
|
||||
|
||||
// Initialize the resource system
|
||||
@@ -38,6 +38,6 @@ auto shouldUseResourcePack(const std::string& filepath) -> bool;
|
||||
auto isPackLoaded() -> bool;
|
||||
|
||||
} // namespace ResourceHelper
|
||||
} // namespace jdd
|
||||
} // namespace Jdd
|
||||
|
||||
#endif // RESOURCE_HELPER_HPP
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace jdd {
|
||||
namespace Jdd {
|
||||
|
||||
// Get singleton instance
|
||||
auto ResourceLoader::get() -> ResourceLoader& {
|
||||
@@ -196,4 +196,4 @@ auto ResourceLoader::loadAssetsConfig() const -> std::string {
|
||||
return config_content;
|
||||
}
|
||||
|
||||
} // namespace jdd
|
||||
} // namespace Jdd
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "resource_pack.hpp"
|
||||
|
||||
namespace jdd {
|
||||
namespace Jdd {
|
||||
|
||||
// Singleton class for loading resources from pack or filesystem
|
||||
class ResourceLoader {
|
||||
@@ -64,6 +64,6 @@ class ResourceLoader {
|
||||
bool initialized_{false};
|
||||
};
|
||||
|
||||
} // namespace jdd
|
||||
} // namespace Jdd
|
||||
|
||||
#endif // RESOURCE_LOADER_HPP
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace jdd {
|
||||
namespace Jdd {
|
||||
|
||||
// Calculate CRC32 checksum for data verification
|
||||
auto ResourcePack::calculateChecksum(const std::vector<uint8_t>& data) -> uint32_t {
|
||||
@@ -100,7 +100,7 @@ auto ResourcePack::addDirectory(const std::string& dir_path,
|
||||
std::string relative_path = entry.path().lexically_relative(dir_path).string();
|
||||
|
||||
// Convert backslashes to forward slashes (Windows compatibility)
|
||||
std::replace(relative_path.begin(), relative_path.end(), '\\', '/');
|
||||
std::ranges::replace(relative_path, '\\', '/');
|
||||
|
||||
// Skip development files
|
||||
if (relative_path.find(".world") != std::string::npos ||
|
||||
@@ -129,13 +129,13 @@ auto ResourcePack::savePack(const std::string& pack_file) -> bool {
|
||||
file.write(reinterpret_cast<const char*>(&VERSION), sizeof(VERSION));
|
||||
|
||||
// Write resource count
|
||||
uint32_t resource_count = static_cast<uint32_t>(resources_.size());
|
||||
auto resource_count = static_cast<uint32_t>(resources_.size());
|
||||
file.write(reinterpret_cast<const char*>(&resource_count), sizeof(resource_count));
|
||||
|
||||
// Write resource entries
|
||||
for (const auto& [name, entry] : resources_) {
|
||||
// Write filename length and name
|
||||
uint32_t name_len = static_cast<uint32_t>(entry.filename.length());
|
||||
auto name_len = static_cast<uint32_t>(entry.filename.length());
|
||||
file.write(reinterpret_cast<const char*>(&name_len), sizeof(name_len));
|
||||
file.write(entry.filename.c_str(), name_len);
|
||||
|
||||
@@ -269,7 +269,7 @@ auto ResourcePack::getResourceList() const -> std::vector<std::string> {
|
||||
for (const auto& [name, entry] : resources_) {
|
||||
list.push_back(name);
|
||||
}
|
||||
std::sort(list.begin(), list.end());
|
||||
std::ranges::sort(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ auto ResourcePack::calculatePackChecksum() const -> uint32_t {
|
||||
for (const auto& [name, entry] : resources_) {
|
||||
sorted_names.push_back(name);
|
||||
}
|
||||
std::sort(sorted_names.begin(), sorted_names.end());
|
||||
std::ranges::sort(sorted_names);
|
||||
|
||||
// Combine individual checksums
|
||||
for (const auto& name : sorted_names) {
|
||||
@@ -300,4 +300,4 @@ auto ResourcePack::calculatePackChecksum() const -> uint32_t {
|
||||
return global_checksum;
|
||||
}
|
||||
|
||||
} // namespace jdd
|
||||
} // namespace Jdd
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace jdd {
|
||||
namespace Jdd {
|
||||
|
||||
// Entry metadata for each resource in the pack
|
||||
struct ResourceEntry {
|
||||
@@ -32,9 +32,9 @@ class ResourcePack {
|
||||
|
||||
// Disable copy/move
|
||||
ResourcePack(const ResourcePack&) = delete;
|
||||
ResourcePack& operator=(const ResourcePack&) = delete;
|
||||
auto operator=(const ResourcePack&) -> ResourcePack& = delete;
|
||||
ResourcePack(ResourcePack&&) = delete;
|
||||
ResourcePack& operator=(ResourcePack&&) = delete;
|
||||
auto operator=(ResourcePack&&) -> ResourcePack& = delete;
|
||||
|
||||
// Add a single file to the pack
|
||||
auto addFile(const std::string& filepath, const std::string& pack_name) -> bool;
|
||||
@@ -89,6 +89,6 @@ class ResourcePack {
|
||||
bool loaded_{false};
|
||||
};
|
||||
|
||||
} // namespace jdd
|
||||
} // namespace Jdd
|
||||
|
||||
#endif // RESOURCE_PACK_HPP
|
||||
|
||||
Reference in New Issue
Block a user