summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-02 22:09:41 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-02 22:10:21 +0100
commite8ec55df9173c588a774f50e71cfd2be77271166 (patch)
treef6d2b9611ae02850f9ab47e28499e0495cafe8bf /src/utils
parent83df149da22fe69787b4b543022e8a1c18555643 (diff)
downloadmana-e8ec55df9173c588a774f50e71cfd2be77271166.tar.gz
mana-e8ec55df9173c588a774f50e71cfd2be77271166.tar.bz2
mana-e8ec55df9173c588a774f50e71cfd2be77271166.tar.xz
mana-e8ec55df9173c588a774f50e71cfd2be77271166.zip
Restored support for setting monster ID offset on monsters tag
Apparently this was supported before, but support for that was lost in bd1fdd87eed48ba3ffcc413936d6a6a60a429a97. Fixes #46
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/xml.cpp5
-rw-r--r--src/utils/xml.h9
2 files changed, 12 insertions, 2 deletions
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index d0f51230..2fb9d66b 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -92,6 +92,11 @@ namespace XML
return mDoc ? xmlDocGetRootElement(mDoc) : nullptr;
}
+ bool hasProperty(xmlNodePtr node, const char *name)
+ {
+ return xmlHasProp(node, BAD_CAST name) != nullptr;
+ }
+
int getProperty(xmlNodePtr node, const char* name, int def)
{
int &ret = def;
diff --git a/src/utils/xml.h b/src/utils/xml.h
index 60355aa6..df8dd1bd 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -60,9 +60,9 @@ namespace XML
};
/**
- * Gets an floating point property from an xmlNodePtr.
+ * Returns whether a certain property is present.
*/
- double getFloatProperty(xmlNodePtr node, const char *name, double def);
+ bool hasProperty(xmlNodePtr node, const char *name);
/**
* Gets an integer property from an xmlNodePtr.
@@ -70,6 +70,11 @@ namespace XML
int getProperty(xmlNodePtr node, const char *name, int def);
/**
+ * Gets an floating point property from an xmlNodePtr.
+ */
+ double getFloatProperty(xmlNodePtr node, const char *name, double def);
+
+ /**
* Gets a string property from an xmlNodePtr.
*/
std::string getProperty(xmlNodePtr node, const char *name,