New setting: show_height_as_units

This commit is contained in:
atmaxinger 2014-05-28 11:12:12 +02:00
parent 098fe08fdf
commit 4ae98b18e6
3 changed files with 29 additions and 3 deletions

View File

@ -87,6 +87,7 @@ general_configuration_t gGeneral_config_default = {
1, // edge_scrolling
0, // always_show_gridlines
1, // landscape_smoothing
0, // show_height_as_units
};
sound_configuration_t gSound_config;
@ -158,7 +159,13 @@ void config_load()
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) &= !CONFIG_FLAG_DISABLE_SMOOTH_LANDSCAPE;
}
// show height as units
if (gGeneral_config.show_height_as_units){
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
}
else {
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) &= !CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
}
//sound configuration
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_SOUND_QUALITY, sint8) = gSound_config.sound_quality;
@ -343,6 +350,13 @@ void config_write_ini_general(FILE *fp)
else {
fprintf(fp, "landscape_smoothing = false\n");
}
if (gGeneral_config.show_height_as_units){
fprintf(fp, "show_height_as_units = true\n");
}
else {
fprintf(fp, "show_height_as_units = false\n");
}
}
/**
@ -557,6 +571,14 @@ static void config_general(char *setting, char *value){
gGeneral_config.landscape_smoothing = 0;
}
}
else if (strcmp(setting, "show_height_as_units") == 0){
if (strcmp(value, "true") == 0){
gGeneral_config.show_height_as_units = 1;
}
else {
gGeneral_config.show_height_as_units = 0;
}
}
}
/**

View File

@ -138,6 +138,7 @@ typedef struct general_configuration {
sint8 edge_scrolling;
sint8 always_show_gridlines;
sint8 landscape_smoothing;
sint8 show_height_as_units;
} general_configuration_t;
static const struct { char *key; int value; } _currencyLookupTable[] = {

View File

@ -451,9 +451,12 @@ static void window_options_dropdown()
case WIDX_HEIGHT_LABELS_DROPDOWN:
// reset flag and set it to 1 if height as units is selected
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) &= ~CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
gGeneral_config.show_height_as_units = 0;
if (dropdownIndex == 0)
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
if (dropdownIndex == 0) {
RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) |= CONFIG_FLAG_SHOW_HEIGHT_AS_UNITS;
gGeneral_config.show_height_as_units = 1;
}
window_options_update_height_markers();
break;