diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index 9af1db504f..bddb70aa02 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -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 diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index 13501ac8c9..09a3d1f516 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -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"); diff --git a/components/settings/settings.hpp b/components/settings/settings.hpp index ecc5aa5fd3..e3a29d4c34 100644 --- a/components/settings/settings.hpp +++ b/components/settings/settings.hpp @@ -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);