summaryrefslogtreecommitdiff
path: root/src/configuration.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-01 21:35:49 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-01 22:40:36 +0300
commitfc854786ed73fe768d6a3ca22c02f7013560a930 (patch)
tree3a12f555d194679957559760567ff8eb701b494b /src/configuration.cpp
parent09d74d9273cca445b7019edacaff53452a1eee3c (diff)
downloadManaVerse-fc854786ed73fe768d6a3ca22c02f7013560a930.tar.gz
ManaVerse-fc854786ed73fe768d6a3ca22c02f7013560a930.tar.bz2
ManaVerse-fc854786ed73fe768d6a3ca22c02f7013560a930.tar.xz
ManaVerse-fc854786ed73fe768d6a3ca22c02f7013560a930.zip
Fix code style.
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r--src/configuration.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index defa38812..d61e24a3b 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -364,19 +364,19 @@ int Configuration::getIntValue(const std::string &key) const
if (itdef != mDefaultsData->end() && itdef->second)
{
- if (itdef->second->getType() == VariableData::DATA_INT)
+ VariableData::DataType type = static_cast<
+ VariableData::DataType>(itdef->second->getType());
+ if (type == VariableData::DATA_INT)
{
defaultValue = (static_cast<IntData*>(
itdef->second))->getData();
}
- else if (itdef->second->getType()
- == VariableData::DATA_STRING)
+ else if (type == VariableData::DATA_STRING)
{
defaultValue = atoi((static_cast<StringData*>(
itdef->second))->getData().c_str());
}
- else if (itdef->second->getType()
- == VariableData::DATA_BOOL)
+ else if (type == VariableData::DATA_BOOL)
{
if ((static_cast<BoolData*>(
itdef->second))->getData())
@@ -388,7 +388,7 @@ int Configuration::getIntValue(const std::string &key) const
defaultValue = 0;
}
}
- else if (itdef->second->getType() == VariableData::DATA_FLOAT)
+ else if (type == VariableData::DATA_FLOAT)
{
defaultValue = static_cast<int>(
(static_cast<FloatData*>(itdef->second))->getData());
@@ -445,14 +445,14 @@ std::string Configuration::getStringValue(const std::string &key) const
if (itdef != mDefaultsData->end() && itdef->second)
{
- if (itdef->second->getType()
- == VariableData::DATA_STRING)
+ VariableData::DataType type = static_cast<
+ VariableData::DataType>(itdef->second->getType());
+ if (type == VariableData::DATA_STRING)
{
defaultValue = (static_cast<StringData*>(
itdef->second))->getData();
}
- else if (itdef->second->getType()
- == VariableData::DATA_BOOL)
+ else if (type == VariableData::DATA_BOOL)
{
if ((static_cast<BoolData*>(
itdef->second))->getData())
@@ -464,8 +464,7 @@ std::string Configuration::getStringValue(const std::string &key) const
defaultValue = "0";
}
}
- else if (itdef->second->getType()
- == VariableData::DATA_INT)
+ else if (type == VariableData::DATA_INT)
{
defaultValue = toString((static_cast<IntData*>(
itdef->second))->getData());
@@ -499,20 +498,20 @@ float Configuration::getFloatValue(const std::string &key) const
if (itdef != mDefaultsData->end() && itdef->second)
{
- if (itdef->second->getType() == VariableData::DATA_FLOAT)
+ VariableData::DataType type = static_cast<
+ VariableData::DataType>(itdef->second->getType());
+ if (type == VariableData::DATA_FLOAT)
{
defaultValue = static_cast<float>(
(static_cast<FloatData*>(itdef->second))->getData());
}
- else if (itdef->second->getType()
- == VariableData::DATA_STRING)
+ else if (type == VariableData::DATA_STRING)
{
defaultValue = static_cast<float>(atof((
static_cast<StringData*>(
itdef->second))->getData().c_str()));
}
- else if (itdef->second->getType()
- == VariableData::DATA_BOOL)
+ else if (type == VariableData::DATA_BOOL)
{
if ((static_cast<BoolData*>(
itdef->second))->getData())
@@ -524,8 +523,7 @@ float Configuration::getFloatValue(const std::string &key) const
defaultValue = 0;
}
}
- else if (itdef->second->getType()
- == VariableData::DATA_INT)
+ else if (type == VariableData::DATA_INT)
{
defaultValue = static_cast<float>((static_cast<IntData*>(
itdef->second))->getData());
@@ -558,13 +556,14 @@ bool Configuration::getBoolValue(const std::string &key) const
if (itdef != mDefaultsData->end() && itdef->second)
{
- if (itdef->second->getType() == VariableData::DATA_BOOL)
+ VariableData::DataType type = static_cast<
+ VariableData::DataType>(itdef->second->getType());
+ if (type == VariableData::DATA_BOOL)
{
defaultValue = (static_cast<BoolData*>(
itdef->second))->getData();
}
- else if (itdef->second->getType()
- == VariableData::DATA_INT)
+ else if (type == VariableData::DATA_INT)
{
if ((static_cast<IntData*>(
itdef->second))->getData() != 0)
@@ -576,8 +575,7 @@ bool Configuration::getBoolValue(const std::string &key) const
defaultValue = false;
}
}
- else if (itdef->second->getType()
- == VariableData::DATA_STRING)
+ else if (type == VariableData::DATA_STRING)
{
if ((static_cast<StringData*>(
itdef->second))->getData() != "0")
@@ -589,7 +587,7 @@ bool Configuration::getBoolValue(const std::string &key) const
defaultValue = false;
}
}
- if (itdef->second->getType() == VariableData::DATA_FLOAT)
+ if (type == VariableData::DATA_FLOAT)
{
if (static_cast<int>((static_cast<FloatData*>(
itdef->second))->getData()) != 0)