summaryrefslogtreecommitdiff
path: root/src/resources/beingcommon.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-06 14:47:39 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-06 14:47:39 +0300
commitb7ee14cadb1e5675f7e36565aec1fe39e55ccc34 (patch)
treed92328178a64cd15891802ced4a0db5a0a751e11 /src/resources/beingcommon.cpp
parent3cb15a8f777bd9907d8dc4ba57774c762ec1f67f (diff)
downloadmv-b7ee14cadb1e5675f7e36565aec1fe39e55ccc34.tar.gz
mv-b7ee14cadb1e5675f7e36565aec1fe39e55ccc34.tar.bz2
mv-b7ee14cadb1e5675f7e36565aec1fe39e55ccc34.tar.xz
mv-b7ee14cadb1e5675f7e36565aec1fe39e55ccc34.zip
add ability to inlude config parts from subdirs for items, monsters, npcs.
Diffstat (limited to 'src/resources/beingcommon.cpp')
-rw-r--r--src/resources/beingcommon.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp
index 174a6edfd..5647d01e3 100644
--- a/src/resources/beingcommon.cpp
+++ b/src/resources/beingcommon.cpp
@@ -20,8 +20,14 @@
#include "resources/beingcommon.h"
+#include "utils/files.h"
+#include "utils/physfstools.h"
+#include "utils/stringutils.h"
+
#include "resources/beinginfo.h"
+#include <algorithm>
+
#include "debug.h"
void BeingCommon::readBasicAttributes(BeingInfo *const info, XmlNodePtr node,
@@ -42,3 +48,17 @@ void BeingCommon::readBasicAttributes(BeingInfo *const info, XmlNodePtr node,
info->setHpBarOffsetX(XML::getProperty(node, "hpBarOffsetX", 0));
info->setHpBarOffsetY(XML::getProperty(node, "hpBarOffsetY", 0));
}
+
+void BeingCommon::getIncludeFiles(const std::string &dir, StringVect &list)
+{
+ const std::string path = dir + PhysFs::getDirSeparator();
+ StringVect tempList;
+ Files::getFilesWithDir(path, tempList);
+ FOR_EACH (StringVectCIter, it, tempList)
+ {
+ const std::string &str = *it;
+ if (findLast(str, ".xml"))
+ list.push_back(str);
+ }
+ std::sort(list.begin(), list.end());
+}