From: chaoskagami Date: Sat, 23 Jul 2016 13:31:32 +0000 (-0400) Subject: Allow updating the 'accent color' value for old configs (it would cause issues, other... X-Git-Tag: v0.2.0~7 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=5dccb02b8032e6ca98801d09fa1d884a26427dc3;p=corbenik%2Fcorbenik.git Allow updating the 'accent color' value for old configs (it would cause issues, otherwise) --- diff --git a/source/option.c b/source/option.c index a52e123..0125d49 100644 --- a/source/option.c +++ b/source/option.c @@ -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