summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-25 18:40:05 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-25 18:40:05 +0300
commit2157b8c6629cea79801566244fc3f1d8491e91be (patch)
treefb999e7d464c70511f13472da0fba86749b8d737 /src/resources
parente89fb908638196c9484a2038e3f3eb18db6ef4ee (diff)
downloadplus-2157b8c6629cea79801566244fc3f1d8491e91be.tar.gz
plus-2157b8c6629cea79801566244fc3f1d8491e91be.tar.bz2
plus-2157b8c6629cea79801566244fc3f1d8491e91be.tar.xz
plus-2157b8c6629cea79801566244fc3f1d8491e91be.zip
Add file utils function getFilesInDir.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/beingcommon.cpp16
-rw-r--r--src/resources/beingcommon.h4
-rw-r--r--src/resources/db/avatardb.cpp1
-rw-r--r--src/resources/db/badgesdb.cpp3
-rw-r--r--src/resources/db/colordb.cpp4
-rw-r--r--src/resources/db/commandsdb.cpp2
-rw-r--r--src/resources/db/deaddb.cpp1
-rw-r--r--src/resources/db/emotedb.cpp2
-rw-r--r--src/resources/db/homunculusdb.cpp1
-rw-r--r--src/resources/db/horsedb.cpp1
-rw-r--r--src/resources/db/itemdb.cpp3
-rw-r--r--src/resources/db/mapdb.cpp2
-rw-r--r--src/resources/db/mercenarydb.cpp1
-rw-r--r--src/resources/db/moddb.cpp1
-rw-r--r--src/resources/db/monsterdb.cpp1
-rw-r--r--src/resources/db/npcdb.cpp1
-rw-r--r--src/resources/db/npcdialogdb.cpp1
-rw-r--r--src/resources/db/petdb.cpp3
-rw-r--r--src/resources/db/skillunitdb.cpp3
-rw-r--r--src/resources/db/sounddb.cpp2
-rw-r--r--src/resources/mapreader.cpp1
21 files changed, 31 insertions, 23 deletions
diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp
index 999b19980..67aeea4fb 100644
--- a/src/resources/beingcommon.cpp
+++ b/src/resources/beingcommon.cpp
@@ -82,22 +82,6 @@ void BeingCommon::readBasicAttributes(BeingInfo *const info,
info->setBlockWalkMask(static_cast<unsigned char>(block ^ allFlags));
}
-void BeingCommon::getIncludeFiles(const std::string &dir,
- StringVect &list,
- const std::string &ext)
-{
- const std::string path = dir + "/";
- StringVect tempList;
- Files::getFilesWithDir(path, tempList);
- FOR_EACH (StringVectCIter, it, tempList)
- {
- const std::string &str = *it;
- if (findLast(str, ext))
- list.push_back(str);
- }
- std::sort(list.begin(), list.end());
-}
-
bool BeingCommon::readObjectNodes(XmlNodePtrConst &spriteNode,
SpriteDisplay &display,
BeingInfo *const currentInfo,
diff --git a/src/resources/beingcommon.h b/src/resources/beingcommon.h
index 273c95e11..04551092f 100644
--- a/src/resources/beingcommon.h
+++ b/src/resources/beingcommon.h
@@ -34,7 +34,7 @@ struct SpriteDisplay;
#define loadXmlDir(name, function) \
{ \
StringVect listVect; \
- BeingCommon::getIncludeFiles(paths.getStringValue( \
+ Files::getFilesInDir(paths.getStringValue( \
name), listVect, ".xml"); \
FOR_EACH (StringVectCIter, itVect, listVect) \
function(*itVect); \
@@ -43,7 +43,7 @@ struct SpriteDisplay;
#define loadXmlDir2(name, function, ext) \
{ \
StringVect listVect; \
- BeingCommon::getIncludeFiles(name, listVect, ext); \
+ Files::getFilesInDir(name, listVect, ext); \
FOR_EACH (StringVectCIter, itVect, listVect) \
function(*itVect); \
}
diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp
index 5b377b173..d11e8ab63 100644
--- a/src/resources/db/avatardb.cpp
+++ b/src/resources/db/avatardb.cpp
@@ -30,6 +30,7 @@
#include "resources/sprite/spritereference.h"
#include "utils/dtor.h"
+#include "utils/files.h"
#include "utils/gettext.h"
#include "configuration.h"
diff --git a/src/resources/db/badgesdb.cpp b/src/resources/db/badgesdb.cpp
index ccaa1dc3d..de8f48499 100644
--- a/src/resources/db/badgesdb.cpp
+++ b/src/resources/db/badgesdb.cpp
@@ -24,6 +24,7 @@
#include "resources/beingcommon.h"
+#include "utils/files.h"
#include "utils/xmlutils.h"
#include "debug.h"
@@ -57,7 +58,7 @@ static void loadDB(const std::string &name, BadgesInfos &arr)
name, arr);
StringVect listVect;
- BeingCommon::getIncludeFiles(paths.getStringValue(
+ Files::getFilesInDir(paths.getStringValue(
"badgesPatchDir"), listVect, ".xml");
FOR_EACH (StringVectCIter, itVect, listVect)
loadXmlFile(*itVect, name, arr);
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp
index 6b4ae2cd1..674f70ef6 100644
--- a/src/resources/db/colordb.cpp
+++ b/src/resources/db/colordb.cpp
@@ -26,6 +26,8 @@
#include "resources/beingcommon.h"
+#include "utils/files.h"
+
#include "debug.h"
namespace
@@ -48,7 +50,7 @@ void ColorDB::load()
loadHair(paths.getStringValue("hairColorFile"), colors);
loadHair(paths.getStringValue("hairColorPatchFile"), colors);
StringVect list;
- BeingCommon::getIncludeFiles(paths.getStringValue(
+ Files::getFilesInDir(paths.getStringValue(
"hairColorPatchDir"), list, ".xml");
FOR_EACH (StringVectCIter, it2, list)
loadHair(*it2, colors);
diff --git a/src/resources/db/commandsdb.cpp b/src/resources/db/commandsdb.cpp
index 335627c53..daf347473 100644
--- a/src/resources/db/commandsdb.cpp
+++ b/src/resources/db/commandsdb.cpp
@@ -28,6 +28,8 @@
#include "resources/beingcommon.h"
+#include "utils/files.h"
+
#include "debug.h"
namespace
diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp
index a2a6a6494..ce77aa6b4 100644
--- a/src/resources/db/deaddb.cpp
+++ b/src/resources/db/deaddb.cpp
@@ -23,6 +23,7 @@
#include "configuration.h"
#include "logger.h"
+#include "utils/files.h"
#include "utils/translation/podict.h"
#include "resources/beingcommon.h"
diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp
index b2f9a0581..32679a9dc 100644
--- a/src/resources/db/emotedb.cpp
+++ b/src/resources/db/emotedb.cpp
@@ -32,6 +32,8 @@
#include "resources/sprite/animatedsprite.h"
+#include "utils/files.h"
+
#include "debug.h"
namespace
diff --git a/src/resources/db/homunculusdb.cpp b/src/resources/db/homunculusdb.cpp
index e8d2f723e..6f8164742 100644
--- a/src/resources/db/homunculusdb.cpp
+++ b/src/resources/db/homunculusdb.cpp
@@ -28,6 +28,7 @@
#include "resources/beinginfo.h"
#include "utils/dtor.h"
+#include "utils/files.h"
#include "configuration.h"
diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp
index 27987c657..99139fb21 100644
--- a/src/resources/db/horsedb.cpp
+++ b/src/resources/db/horsedb.cpp
@@ -28,6 +28,7 @@
#include "resources/horseinfo.h"
#include "utils/dtor.h"
+#include "utils/files.h"
#include "debug.h"
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 6a3766cc6..620367bd1 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -41,6 +41,7 @@
#include "utils/delete2.h"
#include "utils/dtor.h"
+#include "utils/files.h"
#include "utils/stringmap.h"
#include "debug.h"
@@ -250,7 +251,7 @@ void ItemDB::load()
loadXmlFile(paths.getStringValue("itemsPatchFile"), tagNum);
StringVect list;
- BeingCommon::getIncludeFiles(paths.getStringValue("itemsPatchDir"),
+ Files::getFilesInDir(paths.getStringValue("itemsPatchDir"),
list,
".xml");
FOR_EACH (StringVectCIter, it, list)
diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp
index 6d31c69f2..521d7ac84 100644
--- a/src/resources/db/mapdb.cpp
+++ b/src/resources/db/mapdb.cpp
@@ -26,6 +26,8 @@
#include "resources/beingcommon.h"
+#include "utils/files.h"
+
#include "debug.h"
namespace
diff --git a/src/resources/db/mercenarydb.cpp b/src/resources/db/mercenarydb.cpp
index 26476892d..bc5374f51 100644
--- a/src/resources/db/mercenarydb.cpp
+++ b/src/resources/db/mercenarydb.cpp
@@ -28,6 +28,7 @@
#include "resources/beinginfo.h"
#include "utils/dtor.h"
+#include "utils/files.h"
#include "configuration.h"
diff --git a/src/resources/db/moddb.cpp b/src/resources/db/moddb.cpp
index 3a803a9af..051fe09e5 100644
--- a/src/resources/db/moddb.cpp
+++ b/src/resources/db/moddb.cpp
@@ -28,6 +28,7 @@
#include "resources/beingcommon.h"
#include "utils/dtor.h"
+#include "utils/files.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp
index 133b2545d..1c18ada0b 100644
--- a/src/resources/db/monsterdb.cpp
+++ b/src/resources/db/monsterdb.cpp
@@ -28,6 +28,7 @@
#include "resources/beinginfo.h"
#include "utils/dtor.h"
+#include "utils/files.h"
#include "utils/gettext.h"
#include "configuration.h"
diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp
index 1827cd859..dff7b4c70 100644
--- a/src/resources/db/npcdb.cpp
+++ b/src/resources/db/npcdb.cpp
@@ -31,6 +31,7 @@
#include "resources/sprite/spritereference.h"
#include "utils/dtor.h"
+#include "utils/files.h"
#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/resources/db/npcdialogdb.cpp b/src/resources/db/npcdialogdb.cpp
index 772a64a45..610925864 100644
--- a/src/resources/db/npcdialogdb.cpp
+++ b/src/resources/db/npcdialogdb.cpp
@@ -27,6 +27,7 @@
#include "resources/npcdialoginfo.h"
#include "utils/dtor.h"
+#include "utils/files.h"
#include "debug.h"
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index 160306d71..17ffba502 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -30,8 +30,9 @@
#include "resources/sprite/spritereference.h"
-#include "utils/gettext.h"
#include "utils/dtor.h"
+#include "utils/files.h"
+#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/resources/db/skillunitdb.cpp b/src/resources/db/skillunitdb.cpp
index 30d0b3918..6ffcfbe18 100644
--- a/src/resources/db/skillunitdb.cpp
+++ b/src/resources/db/skillunitdb.cpp
@@ -30,8 +30,9 @@
#include "resources/sprite/spritereference.h"
-#include "utils/gettext.h"
#include "utils/dtor.h"
+#include "utils/files.h"
+#include "utils/gettext.h"
#include "debug.h"
diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp
index 238e17b51..955a20d1f 100644
--- a/src/resources/db/sounddb.cpp
+++ b/src/resources/db/sounddb.cpp
@@ -27,6 +27,8 @@
#include "resources/beingcommon.h"
+#include "utils/files.h"
+
#include "debug.h"
namespace
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 9da094d54..f55551982 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -50,6 +50,7 @@
#include "utils/base64.h"
#include "utils/delete2.h"
+#include "utils/files.h"
#include "utils/stringmap.h"
#include <zlib.h>