Preventing type conversion of double to float for objectPagingMinSize

pull/3094/head
Thunderforge 4 years ago
parent 9f2f5174d4
commit 89950e5528

@ -136,7 +136,7 @@ bool Launcher::AdvancedPage::loadSettings()
loadSettingBool(activeGridObjectPagingCheckBox, "object paging active grid", "Terrain");
viewingDistanceComboBox->setValue(convertToCells(Settings::Manager::getInt("viewing distance", "Camera")));
objectPagingMinSizeComboBox->setValue(Settings::Manager::getFloat("object paging min size", "Terrain"));
objectPagingMinSizeComboBox->setValue(Settings::Manager::getDouble("object paging min size", "Terrain"));
}
// Audio
@ -289,8 +289,8 @@ void Launcher::AdvancedPage::saveSettings()
Settings::Manager::setInt("viewing distance", "Camera", convertToUnits(viewingDistance));
}
double objectPagingMinSize = objectPagingMinSizeComboBox->value();
if (objectPagingMinSize != Settings::Manager::getFloat("object paging min size", "Terrain"))
Settings::Manager::setFloat("object paging min size", "Terrain", objectPagingMinSize);
if (objectPagingMinSize != Settings::Manager::getDouble("object paging min size", "Terrain"))
Settings::Manager::setDouble("object paging min size", "Terrain", objectPagingMinSize);
}
// Audio

@ -61,6 +61,15 @@ float Manager::getFloat (const std::string& setting, const std::string& category
return number;
}
double Manager::getDouble (const std::string& setting, const std::string& category)
{
const std::string& value = getString(setting, category);
std::stringstream stream(value);
double number = 0.0;
stream >> number;
return number;
}
int Manager::getInt (const std::string& setting, const std::string& category)
{
const std::string& value = getString(setting, category);
@ -128,6 +137,13 @@ void Manager::setFloat (const std::string &setting, const std::string &category,
setString(setting, category, stream.str());
}
void Manager::setDouble (const std::string &setting, const std::string &category, const double value)
{
std::ostringstream stream;
stream << value;
setString(setting, category, stream.str());
}
void Manager::setBool(const std::string &setting, const std::string &category, const bool value)
{
setString(setting, category, value ? "true" : "false");

@ -44,6 +44,7 @@ namespace Settings
static int getInt (const std::string& setting, const std::string& category);
static float getFloat (const std::string& setting, const std::string& category);
static double getDouble (const std::string& setting, const std::string& category);
static std::string getString (const std::string& setting, const std::string& category);
static bool getBool (const std::string& setting, const std::string& category);
static osg::Vec2f getVector2 (const std::string& setting, const std::string& category);
@ -51,6 +52,7 @@ namespace Settings
static void setInt (const std::string& setting, const std::string& category, const int value);
static void setFloat (const std::string& setting, const std::string& category, const float value);
static void setDouble (const std::string& setting, const std::string& category, const double value);
static void setString (const std::string& setting, const std::string& category, const std::string& value);
static void setBool (const std::string& setting, const std::string& category, const bool value);
static void setVector2 (const std::string& setting, const std::string& category, const osg::Vec2f value);

Loading…
Cancel
Save