1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Use locale info to create default config

Issue #736, get measurement system, temperature system, language and
currency from locale and use it as default.
This commit is contained in:
Thomas
2015-02-19 20:40:14 +01:00
parent e0b2c30b27
commit b8a9745eda
5 changed files with 150 additions and 3 deletions

View File

@@ -200,7 +200,24 @@ void config_set_defaults()
config_property_definition *property = &section->property_definitions[j];
value_union *destValue = (value_union*)((size_t)section->base_address + (size_t)property->offset);
memcpy(destValue, &property->default_value, _configValueTypeSize[property->type]);
if (strcmp(property->property_name, "language") == 0){
destValue->value_uint16 = platform_get_locale_language();
if (destValue->value_uint16 == LANGUAGE_UNDEFINED)
memcpy(destValue, &property->default_value, _configValueTypeSize[property->type]);
}
else if (strcmp(property->property_name, "currency_format") == 0){
destValue->value_uint8 = platform_get_locale_currency();
}
else if (strcmp(property->property_name, "measurement_format") == 0){
destValue->value_uint8 = platform_get_locale_measurement_format();
}
else if (strcmp(property->property_name, "temperature_format") == 0){
destValue->value_uint8 = platform_get_locale_temperature_format();
}
else {
memcpy(destValue, &property->default_value, _configValueTypeSize[property->type]);
}
}
}
}