ja guarda i carrega la tabla de records en el disc

This commit is contained in:
2024-08-16 11:57:58 +02:00
parent 9012e3d79d
commit 7d778a9cfa
3 changed files with 83 additions and 102 deletions

View File

@@ -589,7 +589,7 @@ bool Director::loadConfigFile()
// Procesa el fichero linea a linea
if (options->console)
{
std::cout << "Reading file " << filePath << std::endl;
std::cout << "Reading file: " << filePath << std::endl;
}
while (std::getline(file, line))
{
@@ -612,10 +612,6 @@ bool Director::loadConfigFile()
}
// Cierra el fichero
if (options->console)
{
std::cout << "Closing file " << filePath << std::endl;
}
file.close();
}
@@ -650,24 +646,21 @@ bool Director::loadConfigFile()
// Guarda el fichero de configuración
bool Director::saveConfigFile()
{
bool success = true;
const std::string filename = "config.txt";
std::ofstream file(asset->get(filename));
// Crea y abre el fichero de texto
std::ofstream file(asset->get("config.txt"));
if (file.good())
if (!file.good())
{
if (options->console)
{
std::cout << asset->get("config.txt") << " open for writing" << std::endl;
std::cout << filename << " can't be opened" << std::endl;
}
return false;
}
else
if (options->console)
{
if (options->console)
{
std::cout << asset->get("config.txt") << " can't be opened" << std::endl;
}
std::cout << "Writing file: " << filename << std::endl;
}
// Opciones de video
@@ -774,7 +767,7 @@ bool Director::saveConfigFile()
// Cierra el fichero
file.close();
return success;
return true;
}
// Carga los sonidos del juego