throw an exception if default value for a setting is not found

pull/37/head
scrawl 13 years ago
parent 4f1bcb749f
commit 950bf66334

@ -106,7 +106,7 @@ void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh)
extents *= insert->getScale();
float size = std::max(std::max(extents.x, extents.y), extents.z);
bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) && Settings::Manager::getBool("limit small object distance", "Objects");
bool small = (size < Settings::Manager::getInt("small object size", "Viewing distance")) && Settings::Manager::getBool("limit small object distance", "Viewing distance");
// do not fade out doors. that will cause holes and look stupid
if (ptr.getTypeName().find("Door") != std::string::npos)

@ -75,8 +75,12 @@ const std::string Manager::getString (const std::string& setting, const std::str
if (mNewSettings.find(std::make_pair(category, setting)) != mNewSettings.end())
return mNewSettings[std::make_pair(category, setting)];
std::string defaultval = mDefaultFile.getSetting(setting, category);
return mFile.getSetting(setting, category, defaultval);
std::string defaultval = mDefaultFile.getSetting(setting, category, "NOTFOUND");
std::string val = mFile.getSetting(setting, category, defaultval);
if (val == "NOTFOUND")
throw std::runtime_error("Trying to retrieve a non-existing setting: " + setting + " Make sure the settings-default.cfg file was properly installed.");
return val;
}
const float Manager::getFloat (const std::string& setting, const std::string& category)

Loading…
Cancel
Save