diff --git a/source/game/options.cpp b/source/game/options.cpp index 7e6e092..fe4e823 100644 --- a/source/game/options.cpp +++ b/source/game/options.cpp @@ -14,6 +14,7 @@ #include // Para pair #include "utils/utils.hpp" // Para stringToBool, boolToString, safeStoi +#include "game/defaults.hpp" // Para GameDefaults::VERSION namespace Options { // Declaración de funciones internas @@ -97,8 +98,8 @@ auto readConfigFile(const std::string& file_path) -> bool { // Carga las opciones desde un fichero auto loadFromFile(const std::string& file_path) -> bool { - // Versión actual del fichero - const std::string CONFIG_VERSION = version; + // Versión esperada del fichero + const std::string CONFIG_VERSION = GameDefaults::VERSION; version = ""; // Intenta leer el fichero @@ -144,9 +145,6 @@ auto saveToFile(const std::string& file_path) -> bool { file << "# Versión de la configuración\n"; file << "version " << version << "\n"; - file << "\n## CONTROL\n"; - file << "# Esquema de control: 0 = Cursores, 1 = OPQ, 2 = WAD\n"; - file << "keys " << static_cast(keys) << "\n"; file << "\n## WINDOW\n"; file << "# Zoom de la ventana: 1 = Normal, 2 = Doble, 3 = Triple, ...\n"; @@ -183,6 +181,10 @@ auto saveToFile(const std::string& file_path) -> bool { auto setOptions(const std::string& var, const std::string& value) -> bool { static const std::unordered_map> OPTION_HANDLERS = { {"version", [](const std::string& v) { version = v; }}, + {"keys", [](const std::string& v) { + // Parámetro obsoleto, se ignora silenciosamente para compatibilidad con archivos antiguos + (void)v; + }}, {"window.zoom", [](const std::string& v) { int val = safeStoi(v, GameDefaults::WINDOW_ZOOM); if (val > 0) {