From d8b735a1ef81af70c125a14f9fb694c8ee600e2b Mon Sep 17 00:00:00 2001 From: atmaxinger Date: Wed, 28 May 2014 11:19:49 +0200 Subject: [PATCH] New setting: save_plugin_data --- src/config.c | 24 ++++++++++++++++++++++++ src/config.h | 1 + src/window_options.c | 2 ++ 3 files changed, 27 insertions(+) diff --git a/src/config.c b/src/config.c index e038dc3cab..41551d94a5 100644 --- a/src/config.c +++ b/src/config.c @@ -88,6 +88,7 @@ general_configuration_t gGeneral_config_default = { 0, // always_show_gridlines 1, // landscape_smoothing 0, // show_height_as_units + 1, // save_plugin_data }; sound_configuration_t gSound_config; @@ -167,6 +168,14 @@ void config_load() RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) &= !CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS; } + // save plugin data + if (gGeneral_config.save_plugin_data){ + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= CONFIG_FLAG_SAVE_PLUGIN_DATA; + } + else { + RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) &= !CONFIG_FLAG_SAVE_PLUGIN_DATA; + } + //sound configuration RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = gSound_config.sound_quality; RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_SW_BUFFER, sint8) = gSound_config.forced_software_buffering; @@ -357,6 +366,13 @@ void config_write_ini_general(FILE *fp) else { fprintf(fp, "show_height_as_units = false\n"); } + + if (gGeneral_config.save_plugin_data){ + fprintf(fp, "save_plugin_data = true\n"); + } + else { + fprintf(fp, "save_plugin_data = false\n"); + } } /** @@ -579,6 +595,14 @@ static void config_general(char *setting, char *value){ gGeneral_config.show_height_as_units = 0; } } + else if (strcmp(setting, "save_plugin_data") == 0){ + if (strcmp(value, "true") == 0){ + gGeneral_config.save_plugin_data = 1; + } + else { + gGeneral_config.save_plugin_data = 0; + } + } } /** diff --git a/src/config.h b/src/config.h index be7d72c473..6e43a04b4e 100644 --- a/src/config.h +++ b/src/config.h @@ -139,6 +139,7 @@ typedef struct general_configuration { sint8 always_show_gridlines; sint8 landscape_smoothing; sint8 show_height_as_units; + sint8 save_plugin_data; } general_configuration_t; static const struct { char *key; int value; } _currencyLookupTable[] = { diff --git a/src/window_options.c b/src/window_options.c index 9aaf38e397..5a0646be66 100644 --- a/src/window_options.c +++ b/src/window_options.c @@ -270,6 +270,8 @@ static void window_options_mouseup() break; case WIDX_SAVE_PLUGIN_DATA_CHECKBOX: RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) ^= CONFIG_FLAG_SAVE_PLUGIN_DATA; + gGeneral_config.save_plugin_data = !(RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) + & CONFIG_FLAG_SAVE_PLUGIN_DATA); config_save(); window_invalidate(w); break;