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

View File

@@ -86,18 +86,14 @@ bool loadOptionsFile(std::string file_path)
bool success = true;
// Variables para manejar el fichero
#ifdef VERBOSE
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
#endif
std::ifstream file(file_path);
// Si el fichero se puede abrir
if (file.good())
{
// Procesa el fichero linea a linea
#ifdef VERBOSE
std::cout << "Reading file: " << file_name << std::endl;
#endif
std::string line;
while (std::getline(file, line))
{
@@ -109,10 +105,8 @@ bool loadOptionsFile(std::string file_path)
// Procesa las dos subcadenas
if (!setOptions(line.substr(0, pos), line.substr(pos + 1, line.length())))
{
#ifdef VERBOSE
std::cout << "Warning: file " << file_name << std::endl;
std::cout << "Unknown parameter " << line.substr(0, pos).c_str() << std::endl;
#endif
success = false;
}
}
@@ -152,22 +146,16 @@ bool loadOptionsFile(std::string file_path)
// Guarda el fichero de configuración
bool saveOptionsFile(std::string file_path)
{
#ifdef VERBOSE
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
#endif
std::ofstream file(file_path);
if (!file.good())
{
#ifdef VERBOSE
std::cout << file_name << " can't be opened" << std::endl;
#endif
return false;
}
#ifdef VERBOSE
std::cout << "Writing file: " << file_name << std::endl;
#endif
// Opciones de video
const auto value_video_mode_winow = std::to_string(static_cast<int>(ScreenVideoMode::WINDOW));