summaryrefslogtreecommitdiff
path: root/src/configuration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r--src/configuration.cpp52
1 files changed, 48 insertions, 4 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index c4f1cc360..1ff205195 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -217,6 +217,11 @@ int Configuration::getIntValue(const std::string &key) const
defaultValue = 0;
}
}
+ else if (itdef->second->getType() == VariableData::DATA_FLOAT)
+ {
+ defaultValue = static_cast<int>(
+ (static_cast<FloatData*>(itdef->second))->getData());
+ }
}
else
{
@@ -321,11 +326,38 @@ float Configuration::getFloatValue(const std::string &key) const
{
DefaultsData::const_iterator itdef = mDefaultsData->find(key);
- if (itdef != mDefaultsData->end() && itdef->second
- && itdef->second->getType() == VariableData::DATA_FLOAT)
+ if (itdef != mDefaultsData->end() && itdef->second)
{
- defaultValue = static_cast<float>(
- (static_cast<FloatData*>(itdef->second))->getData());
+ if (itdef->second->getType() == VariableData::DATA_FLOAT)
+ {
+ defaultValue = static_cast<float>(
+ (static_cast<FloatData*>(itdef->second))->getData());
+ }
+ else if (itdef->second->getType()
+ == VariableData::DATA_STRING)
+ {
+ defaultValue = atof((static_cast<StringData*>(
+ itdef->second))->getData().c_str());
+ }
+ else if (itdef->second->getType()
+ == VariableData::DATA_BOOL)
+ {
+ if ((static_cast<BoolData*>(
+ itdef->second))->getData())
+ {
+ defaultValue = 1;
+ }
+ else
+ {
+ defaultValue = 0;
+ }
+ }
+ else if (itdef->second->getType()
+ == VariableData::DATA_INT)
+ {
+ defaultValue = (static_cast<IntData*>(
+ itdef->second))->getData();
+ }
}
else
{
@@ -385,6 +417,18 @@ bool Configuration::getBoolValue(const std::string &key) const
defaultValue = false;
}
}
+ if (itdef->second->getType() == VariableData::DATA_FLOAT)
+ {
+ if (static_cast<int>((static_cast<FloatData*>(
+ itdef->second))->getData()) != 0)
+ {
+ defaultValue = true;
+ }
+ else
+ {
+ defaultValue = false;
+ }
+ }
}
else
{