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:
19
src/config.c
19
src/config.c
@@ -200,7 +200,24 @@ void config_set_defaults()
|
||||
config_property_definition *property = §ion->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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user