using namespace std en todos los ficheros
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
#include <iostream>
|
||||
|
||||
// Constructor
|
||||
Asset::Asset(std::string executablePath)
|
||||
Asset::Asset(string executablePath)
|
||||
{
|
||||
//std::cout << "Construido Asset" << std::endl;
|
||||
//cout << "Construido Asset" << endl;
|
||||
this->executablePath = executablePath.substr(0, executablePath.find_last_of("\\/"));
|
||||
longestName = 0;
|
||||
verbose = true;
|
||||
@@ -13,11 +13,11 @@ Asset::Asset(std::string executablePath)
|
||||
// Destructot
|
||||
Asset::~Asset()
|
||||
{
|
||||
//std::cout << "Destruido Asset" << std::endl;
|
||||
//cout << "Destruido Asset" << endl;
|
||||
}
|
||||
|
||||
// Añade un elemento a la lista
|
||||
void Asset::add(std::string file, enum assetType type, bool required, bool absolute)
|
||||
void Asset::add(string file, enum assetType type, bool required, bool absolute)
|
||||
{
|
||||
item_t temp;
|
||||
temp.file = absolute ? file : executablePath + file;
|
||||
@@ -25,17 +25,17 @@ void Asset::add(std::string file, enum assetType type, bool required, bool absol
|
||||
temp.required = required;
|
||||
fileList.push_back(temp);
|
||||
|
||||
const std::string filename = file.substr(file.find_last_of("\\/") + 1);
|
||||
const string filename = file.substr(file.find_last_of("\\/") + 1);
|
||||
longestName = SDL_max(longestName, filename.size());
|
||||
}
|
||||
|
||||
// Devuelve el fichero de un elemento de la lista a partir de una cadena
|
||||
std::string Asset::get(std::string text)
|
||||
string Asset::get(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 string file = f.file.substr(lastIndex, string::npos);
|
||||
|
||||
if (file == text)
|
||||
{
|
||||
@@ -45,7 +45,7 @@ std::string Asset::get(std::string text)
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "Warning: file " << text.c_str() << " not found" << std::endl;
|
||||
cout << "Warning: file " << text.c_str() << " not found" << endl;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
@@ -57,10 +57,10 @@ bool Asset::check()
|
||||
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "\n** Checking files" << std::endl;
|
||||
cout << "\n** Checking files" << endl;
|
||||
|
||||
std::cout << "Executable path is: " << executablePath << std::endl;
|
||||
std::cout << "Sample filepath: " << fileList.back().file << std::endl;
|
||||
cout << "Executable path is: " << executablePath << endl;
|
||||
cout << "Sample filepath: " << fileList.back().file << endl;
|
||||
}
|
||||
|
||||
// Comprueba la lista de ficheros clasificandolos por tipo
|
||||
@@ -82,7 +82,7 @@ bool Asset::check()
|
||||
{
|
||||
if (verbose)
|
||||
{
|
||||
std::cout << "\n>> " << getTypeName(type).c_str() << " FILES" << std::endl;
|
||||
cout << "\n>> " << getTypeName(type).c_str() << " FILES" << endl;
|
||||
}
|
||||
|
||||
for (auto f : fileList)
|
||||
@@ -100,13 +100,13 @@ bool Asset::check()
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
std::cout << "\n** All files OK.\n"
|
||||
<< std::endl;
|
||||
cout << "\n** All files OK.\n"
|
||||
<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "\n** A file is missing. Exiting.\n"
|
||||
<< std::endl;
|
||||
cout << "\n** A file is missing. Exiting.\n"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,13 +114,13 @@ bool Asset::check()
|
||||
}
|
||||
|
||||
// Comprueba que existe un fichero
|
||||
bool Asset::checkFile(std::string path)
|
||||
bool Asset::checkFile(string path)
|
||||
{
|
||||
bool success = false;
|
||||
std::string result = "ERROR";
|
||||
string result = "ERROR";
|
||||
|
||||
// Comprueba si existe el fichero
|
||||
const std::string filename = path.substr(path.find_last_of("\\/") + 1);
|
||||
const string filename = path.substr(path.find_last_of("\\/") + 1);
|
||||
SDL_RWops *file = SDL_RWFromFile(path.c_str(), "rb");
|
||||
|
||||
if (file != nullptr)
|
||||
@@ -132,19 +132,19 @@ bool Asset::checkFile(std::string path)
|
||||
|
||||
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;
|
||||
cout.setf(ios::left, ios::adjustfield);
|
||||
cout << "Checking file: ";
|
||||
cout.width(longestName + 2);
|
||||
cout.fill('.');
|
||||
cout << filename + " ";
|
||||
cout << " [" + result + "]" << endl;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
// Devuelve el nombre del tipo de recurso
|
||||
std::string Asset::getTypeName(int type)
|
||||
string Asset::getTypeName(int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user