commit de acabar la jornada laboral

This commit is contained in:
2024-10-17 13:57:41 +02:00
parent db884cb422
commit 59de566c5b
24 changed files with 78 additions and 274 deletions
-8
View File
@@ -66,10 +66,8 @@ bool ManageHiScoreTable::loadFromFile(const std::string &file_path)
if (file)
{
#ifdef VERBOSE
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
std::cout << "Reading file: " << file_name.c_str() << std::endl;
#endif
for (int i = 0; i < (int)table_->size(); ++i)
{
int nameSize = 0;
@@ -115,9 +113,7 @@ bool ManageHiScoreTable::loadFromFile(const std::string &file_path)
// Guarda la tabla en un fichero
bool ManageHiScoreTable::saveToFile(const std::string &file_path)
{
#ifdef VERBOSE
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
#endif
auto success = true;
auto file = SDL_RWFromFile(file_path.c_str(), "w+b");
@@ -132,17 +128,13 @@ bool ManageHiScoreTable::saveToFile(const std::string &file_path)
SDL_RWwrite(file, table_->at(i).name.c_str(), nameSize, 1);
}
#ifdef VERBOSE
std::cout << "Writing file: " << file_name.c_str() << std::endl;
#endif
// Cierra el fichero
SDL_RWclose(file);
}
else
{
#ifdef VERBOSE
std::cout << "Error: Unable to save " << file_name.c_str() << " file! " << SDL_GetError() << std::endl;
#endif
}
return success;
}