This commit is contained in:
2025-10-19 22:01:31 +02:00
parent 16306f2325
commit 2b4523d644
101 changed files with 2058 additions and 1564 deletions

View File

@@ -1,17 +1,18 @@
#include "asset.hpp"
#include <SDL3/SDL.h> // Para SDL_LogCategory, SDL_LogInfo, SDL_LogError, SDL_LogWarn
#include <SDL3/SDL.h> // Para SDL_LogWarn, SDL_LogCategory, SDL_LogError
#include <algorithm> // Para std::sort
#include <algorithm> // Para sort
#include <cstddef> // Para size_t
#include <exception> // Para exception
#include <filesystem> // Para std::filesystem
#include <fstream> // Para basic_istream, basic_ifstream, ifstream, istringstream
#include <filesystem> // Para exists, path
#include <fstream> // Para basic_ifstream, basic_istream, basic_ostream, operator<<, ifstream, istringstream, endl
#include <iostream> // Para cout
#include <sstream> // Para basic_istringstream
#include <stdexcept> // Para runtime_error
#include "resource_helper.hpp" // Para ResourceHelper
#include "ui/logger.hpp" // Pâra Logger
#include "resource_helper.hpp" // Para loadFile
#include "ui/logger.hpp" // Para info, section, CYAN
#include "utils.hpp" // Para getFileName
// Singleton
@@ -124,7 +125,7 @@ void Asset::loadFromFile(const std::string& config_file_path, const std::string&
}
}
std::cout << "Loaded " << file_list_.size() << " assets from config file" << std::endl;
std::cout << "Loaded " << file_list_.size() << " assets from config file" << '\n';
file.close();
}
@@ -204,20 +205,18 @@ auto Asset::checkFile(const std::string& path) const -> bool {
// MODO PACK: Usar ResourceHelper (igual que la carga real)
auto data = ResourceHelper::loadFile(path);
return !data.empty();
} else {
// MODO FILESYSTEM: Verificación directa (modo desarrollo)
std::ifstream file(path);
bool success = file.good();
file.close();
} // MODO FILESYSTEM: Verificación directa (modo desarrollo)
std::ifstream file(path);
bool success = file.good();
file.close();
if (!success) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Error: Could not open file: %s",
path.c_str());
}
return success;
if (!success) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Error: Could not open file: %s",
path.c_str());
}
return success;
}
// Parsea string a Type
@@ -290,7 +289,7 @@ auto Asset::getListByType(Type type) const -> std::vector<std::string> {
}
// Ordenar alfabéticamente para garantizar orden consistente
std::sort(list.begin(), list.end());
std::ranges::sort(list);
return list;
}