This commit is contained in:
2026-04-17 22:20:37 +02:00
parent 513eacf356
commit 20b9a95619
38 changed files with 310 additions and 622 deletions

View File

@@ -25,14 +25,14 @@ auto Asset::get() -> Asset * {
}
// Constructor
Asset::Asset(std::string executablePath) {
this->executablePath = executablePath.substr(0, executablePath.find_last_of("\\/"));
longestName = 0;
verbose = true;
Asset::Asset(const std::string &executablePath)
: longestName(0),
executablePath(executablePath.substr(0, executablePath.find_last_of("\\/"))),
verbose(true) {
}
// Añade un elemento a la lista
void Asset::add(std::string file, enum assetType type, bool required, bool absolute) {
void Asset::add(const std::string &file, enum assetType type, bool required, bool absolute) {
item_t temp;
temp.file = absolute ? file : executablePath + file;
temp.type = type;
@@ -44,8 +44,8 @@ void Asset::add(std::string file, enum assetType type, bool required, bool absol
}
// Devuelve el fichero de un elemento de la lista a partir de una cadena
std::string Asset::get(std::string text) {
for (auto f : fileList) {
std::string Asset::get(const std::string &text) {
for (const auto &f : fileList) {
const size_t lastIndex = f.file.find_last_of("/") + 1;
const std::string file = f.file.substr(lastIndex, std::string::npos);
@@ -76,7 +76,7 @@ bool Asset::check() {
// Comprueba si hay ficheros de ese tipo
bool any = false;
for (auto f : fileList) {
for (const auto &f : fileList) {
if ((f.required) && (f.type == type)) {
any = true;
}
@@ -88,7 +88,7 @@ bool Asset::check() {
std::cout << "\n>> " << getTypeName(type).c_str() << " FILES" << std::endl;
}
for (auto f : fileList) {
for (const auto &f : fileList) {
if ((f.required) && (f.type == type)) {
success &= checkFile(f.file);
}
@@ -111,7 +111,7 @@ bool Asset::check() {
}
// Comprueba que existe un fichero
bool Asset::checkFile(std::string path) {
bool Asset::checkFile(const std::string &path) {
bool success = false;
std::string result = "ERROR";