1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 21:59:55 +00:00

Map SettingValueType Cell to float setting type

This commit is contained in:
elsid 2023-05-20 15:00:00 +02:00
parent fdd80f93e9
commit 4be43a2dca
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625

View file

@ -697,27 +697,28 @@ namespace MWGui
float min, max; float min, max;
getSettingMinMax(scroller, min, max); getSettingMinMax(scroller, min, max);
value = min + (max - min) * value; value = min + (max - min) * value;
if (valueType == "Float")
Settings::get<float>(getSettingCategory(scroller), getSettingName(scroller)).set(value);
else
Settings::get<int>(getSettingCategory(scroller), getSettingName(scroller))
.set(static_cast<int>(value));
if (valueType == "Cell") if (valueType == "Cell")
{ {
Settings::get<float>(getSettingCategory(scroller), getSettingName(scroller)).set(value);
std::stringstream ss; std::stringstream ss;
ss << std::fixed << std::setprecision(2) << value / Constants::CellSizeInUnits; ss << std::fixed << std::setprecision(2) << value / Constants::CellSizeInUnits;
valueStr = ss.str(); valueStr = ss.str();
} }
else if (valueType == "Float") else if (valueType == "Float")
{ {
Settings::get<float>(getSettingCategory(scroller), getSettingName(scroller)).set(value);
std::stringstream ss; std::stringstream ss;
ss << std::fixed << std::setprecision(2) << value; ss << std::fixed << std::setprecision(2) << value;
valueStr = ss.str(); valueStr = ss.str();
} }
else else
{
Settings::get<int>(getSettingCategory(scroller), getSettingName(scroller))
.set(static_cast<int>(value));
valueStr = MyGUI::utility::toString(int(value)); valueStr = MyGUI::utility::toString(int(value));
} }
}
else else
{ {
Settings::get<int>(getSettingCategory(scroller), getSettingName(scroller)).set(pos); Settings::get<int>(getSettingCategory(scroller), getSettingName(scroller)).set(pos);