Pasaeta de cppcheck, ale
This commit is contained in:
@@ -260,12 +260,9 @@ std::vector<Animation> AnimatedSprite::loadFromFile(const std::string &file_path
|
||||
{
|
||||
// Inicializa variables
|
||||
std::vector<Animation> animations;
|
||||
auto frames_per_row = 0;
|
||||
auto frame_width = 0;
|
||||
auto frame_height = 0;
|
||||
auto max_tiles = 0;
|
||||
|
||||
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
|
||||
std::ifstream file(file_path);
|
||||
std::string line;
|
||||
|
||||
@@ -273,9 +270,11 @@ std::vector<Animation> AnimatedSprite::loadFromFile(const std::string &file_path
|
||||
if (file.good())
|
||||
{
|
||||
// Procesa el fichero linea a linea
|
||||
std::cout << "Animation loaded: " << file_name << std::endl;
|
||||
std::cout << "Animation loaded: " << getFileName(file_path) << std::endl;
|
||||
while (std::getline(file, line))
|
||||
{
|
||||
auto max_tiles = 0;
|
||||
auto frames_per_row = 0;
|
||||
// Si la linea contiene el texto [animation] se realiza el proceso de carga de una animación
|
||||
if (line == "[animation]")
|
||||
{
|
||||
@@ -324,7 +323,7 @@ std::vector<Animation> AnimatedSprite::loadFromFile(const std::string &file_path
|
||||
|
||||
else
|
||||
{
|
||||
std::cout << "Warning: file " << file_name.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||
std::cout << "Warning: file " << getFileName(file_path).c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||
}
|
||||
}
|
||||
} while (line != "[/animation]");
|
||||
@@ -359,7 +358,7 @@ std::vector<Animation> AnimatedSprite::loadFromFile(const std::string &file_path
|
||||
|
||||
else
|
||||
{
|
||||
std::cout << "Warning: file " << file_name.c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||
std::cout << "Warning: file " << getFileName(file_path).c_str() << "\n, unknown parameter \"" << line.substr(0, pos).c_str() << "\"" << std::endl;
|
||||
}
|
||||
|
||||
// Normaliza valores
|
||||
@@ -384,7 +383,7 @@ std::vector<Animation> AnimatedSprite::loadFromFile(const std::string &file_path
|
||||
// El fichero no se puede abrir
|
||||
else
|
||||
{
|
||||
std::cout << "Warning: Unable to open " << file_name.c_str() << " file" << std::endl;
|
||||
std::cout << "Warning: Unable to open " << getFileName(file_path).c_str() << " file" << std::endl;
|
||||
}
|
||||
|
||||
// Pone un valor por defecto
|
||||
|
||||
Reference in New Issue
Block a user