]> Chaos Git - corbenik/corbenik.git/commitdiff
Allow updating the 'accent color' value for old configs (it would cause issues, other...
authorchaoskagami <chaos.kagami@gmail.com>
Sat, 23 Jul 2016 13:31:32 +0000 (09:31 -0400)
committerchaoskagami <chaos.kagami@gmail.com>
Sat, 23 Jul 2016 13:31:32 +0000 (09:31 -0400)
source/option.c

index a52e123c97b0cc33f712145960c08b3d2095069e..0125d49910e0b25763947e4c8d3a8cefee2a1e8b 100644 (file)
@@ -12,7 +12,7 @@ regenerate_config()
     memset(&config, 0, sizeof(config));
     memcpy(&(config.magic), CONFIG_MAGIC, 4);
     config.config_ver = config_version;
-    config.options[OPTION_ACCENT_COLOR] = 0x2;
+    config.options[OPTION_ACCENT_COLOR] = 2;
 
     if (!(conf_handle = fopen(PATH_CONFIG, "w")))
         abort("Failed to open config for write?\n");
@@ -52,6 +52,22 @@ mk_structure()
           f_mkdir(PATH_LOCEMU);
 }
 
+void
+update_config()
+{
+    int updated = 0;
+
+    if (config.options[OPTION_ACCENT_COLOR] == 0) {
+        fprintf(stderr, "Config update: accent color\n");
+        config.options[OPTION_ACCENT_COLOR] = 2;
+        updated = 1;
+    }
+
+    if (updated) {
+        save_config(); // Save the configuration.
+    }
+}
+
 void
 load_config()
 {
@@ -93,6 +109,8 @@ load_config()
 
     if (!config.options[OPTION_SILENCE])
         fprintf(BOTTOM_SCREEN, "Config file loaded.\n");
+
+    update_config();
 }
 
 void