summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorPhilipp Sehmisch <mana@crushnet.org>2010-07-10 19:00:50 +0200
committerPhilipp Sehmisch <mana@crushnet.org>2010-07-10 19:00:50 +0200
commit105438d77ce83972d70a1ce67728aaf72c9ec2b6 (patch)
treeb290e4f106e33226bac0ada8c30377674683dfda /src/utils
parent9b72b2760e333e92877ec1e4d002fec6e612ad0e (diff)
downloadmana-client-105438d77ce83972d70a1ce67728aaf72c9ec2b6.tar.gz
mana-client-105438d77ce83972d70a1ce67728aaf72c9ec2b6.tar.bz2
mana-client-105438d77ce83972d70a1ce67728aaf72c9ec2b6.tar.xz
mana-client-105438d77ce83972d70a1ce67728aaf72c9ec2b6.zip
Moved parsing of specials.xml from gui/specialswindow.cpp to separate source files.
Restored functional recharge bars in specials window. Individual specials are only shown after the server informed the client about their status. Made level label, use button and progress bars optional. Their use is controlled through specials.xml. The special window button is again shown even when the player has no specials. This problem needs to be solved differently now for architecture reasons. Reviewed-by: Jaxad0127
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/xml.cpp10
-rw-r--r--src/utils/xml.h13
2 files changed, 19 insertions, 4 deletions
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 341f34c0..94e0e38d 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -27,6 +27,7 @@
#include <iostream>
#include <fstream>
+#include <cstring>
namespace XML
{
@@ -135,6 +136,15 @@ namespace XML
return def;
}
+ bool getBoolProperty(xmlNodePtr node, const char* name, bool def)
+ {
+ xmlChar *prop = xmlGetProp(node, BAD_CAST name);
+
+ if (xmlStrEqual(prop, BAD_CAST "true" ) ) return true;
+ if (xmlStrEqual(prop, BAD_CAST "false") ) return false;
+ return def;
+ }
+
xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name)
{
for_each_xml_child_node(child, parent)
diff --git a/src/utils/xml.h b/src/utils/xml.h
index 72745501..253c4e09 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -69,14 +69,14 @@ namespace XML
};
/**
- * Gets an integer property from an xmlNodePtr.
+ * Gets an floating point property from an xmlNodePtr.
*/
- int getProperty(xmlNodePtr node, const char *name, int def);
+ double getFloatProperty(xmlNodePtr node, const char *name, double def);
/**
- * Gets an floating point property from an xmlNodePtr.
+ * Gets an integer property from an xmlNodePtr.
*/
- double getFloatProperty(xmlNodePtr node, const char *name, double def);
+ int getProperty(xmlNodePtr node, const char *name, int def);
/**
* Gets a string property from an xmlNodePtr.
@@ -85,6 +85,11 @@ namespace XML
const std::string &def);
/**
+ * Gets a boolean property from an xmlNodePtr.
+ */
+ bool getBoolProperty(xmlNodePtr node, const char *name, bool def);
+
+ /**
* Finds the first child node with the given name
*/
xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name);