summaryrefslogtreecommitdiff
path: root/src/utils/xml/tinyxml2.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-08-20 00:34:20 +0300
committerAndrei Karas <akaras@inbox.ru>2017-08-20 00:34:20 +0300
commit899d3b925ccb249de881bbc957f6e4ddc754cbbd (patch)
tree4c35a6f21d909f9bc07ed091f0c8e3cb5f700105 /src/utils/xml/tinyxml2.cpp
parent1049de4c76ac6fc85c9f7f2bd35fb62ca787aa4c (diff)
downloadmanaverse-899d3b925ccb249de881bbc957f6e4ddc754cbbd.tar.gz
manaverse-899d3b925ccb249de881bbc957f6e4ddc754cbbd.tar.bz2
manaverse-899d3b925ccb249de881bbc957f6e4ddc754cbbd.tar.xz
manaverse-899d3b925ccb249de881bbc957f6e4ddc754cbbd.zip
Add function for read float and double number from xml.
Diffstat (limited to 'src/utils/xml/tinyxml2.cpp')
-rw-r--r--src/utils/xml/tinyxml2.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/utils/xml/tinyxml2.cpp b/src/utils/xml/tinyxml2.cpp
index 3a1646168..a7275b7f1 100644
--- a/src/utils/xml/tinyxml2.cpp
+++ b/src/utils/xml/tinyxml2.cpp
@@ -198,9 +198,24 @@ namespace XML
return ret;
}
- double getFloatProperty(XmlNodeConstPtr node,
- const char *const name,
- double def)
+ float getFloatProperty(XmlNodeConstPtr node,
+ const char *const name,
+ float def)
+ {
+ float &ret = def;
+
+ if (!node)
+ return ret;
+ const char *attr = node->Attribute(name);
+ if (attr != nullptr)
+ ret = atof(attr);
+
+ return ret;
+ }
+
+ double getDoubleProperty(XmlNodeConstPtr node,
+ const char *const name,
+ double def)
{
double &ret = def;