forked from jaildesigner-jailgames/jaildoctors_dilemma
Añadidos parametros al programa
This commit is contained in:
@@ -6,6 +6,7 @@ Asset::Asset(std::string path)
|
||||
{
|
||||
executablePath = path;
|
||||
longestName = 0;
|
||||
verbose = true;
|
||||
}
|
||||
|
||||
// Añade un elemento a la lista
|
||||
@@ -26,8 +27,8 @@ std::string Asset::get(std::string text)
|
||||
{
|
||||
for (auto f : fileList)
|
||||
{
|
||||
const size_t lastIndex = f.file.find_last_of("/")+1;
|
||||
const std:: string file = f.file.substr(lastIndex, std::string::npos);
|
||||
const size_t lastIndex = f.file.find_last_of("/") + 1;
|
||||
const std::string file = f.file.substr(lastIndex, std::string::npos);
|
||||
|
||||
if (file == text)
|
||||
{
|
||||
@@ -35,7 +36,10 @@ std::string Asset::get(std::string text)
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Warning: file " << text.c_str() << " not found" << std::endl;
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "Warning: file " << text.c_str() << " not found" << std::endl;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -44,7 +48,10 @@ bool Asset::check()
|
||||
{
|
||||
bool success = true;
|
||||
|
||||
std::cout << "\n** Checking files." << std::endl;
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "\n** Checking files." << std::endl;
|
||||
}
|
||||
|
||||
// Comprueba la lista de ficheros clasificandolos por tipo
|
||||
for (int type = 0; type < t_maxAssetType; ++type)
|
||||
@@ -63,7 +70,10 @@ bool Asset::check()
|
||||
// Si hay ficheros de ese tipo, comprueba si existen
|
||||
if (any)
|
||||
{
|
||||
std::cout << "\n>> " << getTypeName(type).c_str() << " FILES" << std::endl;
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "\n>> " << getTypeName(type).c_str() << " FILES" << std::endl;
|
||||
}
|
||||
|
||||
for (auto f : fileList)
|
||||
{
|
||||
@@ -76,15 +86,18 @@ bool Asset::check()
|
||||
}
|
||||
|
||||
// Resultado
|
||||
if (success)
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "\n** All files OK.\n"
|
||||
<< std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "\n** A file is missing. Exiting.\n"
|
||||
<< std::endl;
|
||||
if (success)
|
||||
{
|
||||
std::cout << "\n** All files OK.\n"
|
||||
<< std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "\n** A file is missing. Exiting.\n"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
@@ -107,12 +120,15 @@ bool Asset::checkFile(std::string path)
|
||||
SDL_RWclose(file);
|
||||
}
|
||||
|
||||
std::cout.setf(std::ios::left, std::ios::adjustfield);
|
||||
std::cout << "Checking file: ";
|
||||
std::cout.width(longestName + 2);
|
||||
std::cout.fill('.');
|
||||
std::cout << filename + " ";
|
||||
std::cout << " [" + result + "]" << std::endl;
|
||||
if (verbose)
|
||||
{
|
||||
std::cout.setf(std::ios::left, std::ios::adjustfield);
|
||||
std::cout << "Checking file: ";
|
||||
std::cout.width(longestName + 2);
|
||||
std::cout.fill('.');
|
||||
std::cout << filename + " ";
|
||||
std::cout << " [" + result + "]" << std::endl;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
@@ -162,4 +178,10 @@ std::string Asset::getTypeName(int type)
|
||||
return "ERROR";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Establece si ha de mostrar texto por pantalla
|
||||
void Asset::setVerbose(bool value)
|
||||
{
|
||||
verbose = value;
|
||||
}
|
||||
Reference in New Issue
Block a user