forked from jaildesigner-jailgames/jaildoctors_dilemma
linter
This commit is contained in:
@@ -33,7 +33,7 @@ bool loadFromFile(const std::string& file_path) {
|
||||
bool success = true;
|
||||
|
||||
// Versión actual del fichero
|
||||
const std::string configVersion = version;
|
||||
const std::string CONFIG_VERSION = version;
|
||||
version = "";
|
||||
|
||||
// Variables para manejar el fichero
|
||||
@@ -61,7 +61,8 @@ bool loadFromFile(const std::string& file_path) {
|
||||
|
||||
// Usa un stringstream para dividir la línea en dos partes
|
||||
std::istringstream iss(line);
|
||||
std::string key, value;
|
||||
std::string key;
|
||||
std::string value;
|
||||
|
||||
if (iss >> key >> value) {
|
||||
if (!setOptions(key, value)) {
|
||||
@@ -85,7 +86,7 @@ bool loadFromFile(const std::string& file_path) {
|
||||
}
|
||||
|
||||
// Si la versión de fichero no coincide, crea un fichero nuevo con los valores por defecto
|
||||
if (configVersion != version) {
|
||||
if (CONFIG_VERSION != version) {
|
||||
init();
|
||||
saveToFile(file_path);
|
||||
if (console) {
|
||||
@@ -155,7 +156,7 @@ bool saveToFile(const std::string& file_path) {
|
||||
}
|
||||
|
||||
bool setOptions(const std::string& var, const std::string& value) {
|
||||
static const std::unordered_map<std::string, std::function<void(const std::string&)>> optionHandlers = {
|
||||
static const std::unordered_map<std::string, std::function<void(const std::string&)>> OPTION_HANDLERS = {
|
||||
{"version", [](const std::string& v) { version = v; }},
|
||||
{"keys", [](const std::string& v) {
|
||||
int val = safeStoi(v, static_cast<int>(GameDefaults::CONTROL_SCHEME));
|
||||
@@ -207,8 +208,8 @@ bool setOptions(const std::string& var, const std::string& value) {
|
||||
video.palette = v;
|
||||
}}};
|
||||
|
||||
auto it = optionHandlers.find(var);
|
||||
if (it != optionHandlers.end()) {
|
||||
auto it = OPTION_HANDLERS.find(var);
|
||||
if (it != OPTION_HANDLERS.end()) {
|
||||
it->second(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user