summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-01-06 20:43:46 +0300
committerAndrei Karas <akaras@inbox.ru>2014-01-06 20:43:46 +0300
commit463d5c603ea95f478dff4b12fbca3c7dd05cc8b9 (patch)
tree00412a9d4a91de61ee62b3c8b9c03c928db5d809
parent286e2b7edc988f93e347b6ccfd51da2a56d18d73 (diff)
downloadplus-463d5c603ea95f478dff4b12fbca3c7dd05cc8b9.tar.gz
plus-463d5c603ea95f478dff4b12fbca3c7dd05cc8b9.tar.bz2
plus-463d5c603ea95f478dff4b12fbca3c7dd05cc8b9.tar.xz
plus-463d5c603ea95f478dff4b12fbca3c7dd05cc8b9.zip
add ability to inlude config parts from subdirs for most dbs.
-rw-r--r--src/defaults.cpp8
-rw-r--r--src/resources/beingcommon.h7
-rw-r--r--src/resources/db/avatardb.cpp2
-rw-r--r--src/resources/db/colordb.cpp9
-rw-r--r--src/resources/db/deaddb.cpp3
-rw-r--r--src/resources/db/emotedb.cpp3
-rw-r--r--src/resources/db/mapdb.cpp3
-rw-r--r--src/resources/db/monsterdb.cpp7
-rw-r--r--src/resources/db/npcdb.cpp7
-rw-r--r--src/resources/db/petdb.cpp1
-rw-r--r--src/resources/db/sounddb.cpp3
11 files changed, 41 insertions, 12 deletions
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 0ef44d8e2..e420c8805 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -489,31 +489,39 @@ DefaultsData* getPathsDefaults()
AddDEF("equipmentWindowFile", "equipmentwindow.xml");
AddDEF("emotesFile", "emotes.xml");
AddDEF("emotesPatchFile", "emotes_patch.xml");
+ AddDEF("emotesPatchDir", "emotes.d");
AddDEF("hairColorFile", "hair.xml");
AddDEF("hairColorPatchFile", "hair_patch.xml");
+ AddDEF("hairColorPatchDir", "hair.d");
AddDEF("itemColorsFile", "itemcolors.xml");
AddDEF("itemColorsPatchFile", "itemcolors_patch.xml");
+ AddDEF("itemColorsPatchDir", "itemcolors.d");
AddDEF("charCreationFile", "charcreation.xml");
AddDEF("soundsFile", "sounds.xml");
AddDEF("soundsPatchFile", "sounds_patch.xml");
+ AddDEF("soundsPatchDir", "sounds.d");
AddDEF("itemsFile", "items.xml");
AddDEF("itemsPatchFile", "items_patch.xml");
AddDEF("itemsPatchDir", "items.d");
AddDEF("avatarsFile", "avatars.xml");
AddDEF("avatarsPatchFile", "avatars_patch.xml");
+ AddDEF("avatarsPatchDir", "avatars.d");
AddDEF("npcsFile", "npcs.xml");
AddDEF("npcsPatchFile", "npcs_patch.xml");
AddDEF("npcsPatchDir", "npcs.d");
AddDEF("petsFile", "pets.xml");
AddDEF("petsPatchFile", "pets_patch.xml");
+ AddDEF("petsPatchDir", "pets.d");
AddDEF("monstersFile", "monsters.xml");
AddDEF("monstersPatchFile", "monsters_patch.xml");
AddDEF("monstersPatchDir", "monsters.d");
AddDEF("mapsRemapFile", "maps/remap.xml");
AddDEF("mapsFile", "maps.xml");
AddDEF("mapsPatchFile", "maps_patch.xml");
+ AddDEF("mapsPatchDir", "maps.d");
AddDEF("deadMessagesFile", "deadmessages.xml");
AddDEF("deadMessagesPatchFile", "deadmessages_patch.xml");
+ AddDEF("deadMessagesPatchDir", "deadmessages.d");
return configData;
}
diff --git a/src/resources/beingcommon.h b/src/resources/beingcommon.h
index 6bf481db4..15bab1a34 100644
--- a/src/resources/beingcommon.h
+++ b/src/resources/beingcommon.h
@@ -29,6 +29,13 @@
class BeingInfo;
+#define loadXmlDir(name, function) \
+ StringVect list; \
+ BeingCommon::getIncludeFiles(paths.getStringValue( \
+ name), list); \
+ FOR_EACH (StringVectCIter, it, list) \
+ function(*it);
+
namespace BeingCommon
{
void readBasicAttributes(BeingInfo *const info, XmlNodePtr node,
diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp
index 92f590cf7..a97059c2c 100644
--- a/src/resources/db/avatardb.cpp
+++ b/src/resources/db/avatardb.cpp
@@ -24,6 +24,7 @@
#include "logger.h"
+#include "resources/beingcommon.h"
#include "resources/beinginfo.h"
#include "utils/dtor.h"
@@ -45,6 +46,7 @@ void AvatarDB::load()
unload();
loadXmlFile(paths.getStringValue("avatarsFile"));
loadXmlFile(paths.getStringValue("avatarsPatchFile"));
+ loadXmlDir("avatarsPatchDir", loadXmlFile);
}
void AvatarDB::loadXmlFile(const std::string &fileName)
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp
index 276b7e77a..06dff0d3a 100644
--- a/src/resources/db/colordb.cpp
+++ b/src/resources/db/colordb.cpp
@@ -26,6 +26,8 @@
#include "utils/xml.h"
+#include "resources/beingcommon.h"
+
#include "debug.h"
namespace
@@ -49,12 +51,19 @@ void ColorDB::load()
colors = it->second;
loadHair(paths.getStringValue("hairColorFile"), colors);
loadHair(paths.getStringValue("hairColorPatchFile"), colors);
+ StringVect list;
+ BeingCommon::getIncludeFiles(paths.getStringValue(
+ "hairColorPatchDir"), list);
+ FOR_EACH (StringVectCIter, it, list)
+ loadHair(*it, colors);
+
mColorLists["hair"] = colors;
if (serverVersion >= 1)
{
loadColorLists(paths.getStringValue("itemColorsFile"));
loadColorLists(paths.getStringValue("itemColorsPatchFile"));
+ loadXmlDir("itemColorsPatchDir", loadColorLists);
}
it = mColorLists.find("hair");
diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp
index 6bf5c4719..078813583 100644
--- a/src/resources/db/deaddb.cpp
+++ b/src/resources/db/deaddb.cpp
@@ -25,6 +25,8 @@
#include "utils/translation/podict.h"
+#include "resources/beingcommon.h"
+
#include "debug.h"
namespace
@@ -37,6 +39,7 @@ void DeadDB::load()
{
loadXmlFile(paths.getStringValue("deadMessagesFile"));
loadXmlFile(paths.getStringValue("deadMessagesPatchFile"));
+ loadXmlDir("deadMessagesPatchDir", loadXmlFile);
}
void DeadDB::loadXmlFile(const std::string &fileName)
diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp
index eee6ec388..907bb75c4 100644
--- a/src/resources/db/emotedb.cpp
+++ b/src/resources/db/emotedb.cpp
@@ -27,6 +27,8 @@
#include "configuration.h"
+#include "resources/beingcommon.h"
+
#include "debug.h"
namespace
@@ -54,6 +56,7 @@ void EmoteDB::load()
mLastEmote = 0;
loadXmlFile(paths.getStringValue("emotesFile"));
loadXmlFile(paths.getStringValue("emotesPatchFile"));
+ loadXmlDir("emotesPatchDir", loadXmlFile);
loadSpecialXmlFile("graphics/sprites/manaplus_emotes.xml");
mLoaded = true;
diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp
index 2ff5d1fee..4b5fb0f42 100644
--- a/src/resources/db/mapdb.cpp
+++ b/src/resources/db/mapdb.cpp
@@ -24,6 +24,8 @@
#include "configuration.h"
#include "logger.h"
+#include "resources/beingcommon.h"
+
#include "debug.h"
namespace
@@ -48,6 +50,7 @@ void MapDB::load()
loadRemap();
loadInfo(paths.getStringValue("mapsFile"));
loadInfo(paths.getStringValue("mapsPatchFile"));
+ loadXmlDir("mapsPatchDir", loadInfo);
mLoaded = true;
}
diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp
index d5e36f443..ee6ec3a22 100644
--- a/src/resources/db/monsterdb.cpp
+++ b/src/resources/db/monsterdb.cpp
@@ -50,12 +50,7 @@ void MonsterDB::load()
logger->log1("Initializing monster database...");
loadXmlFile(paths.getStringValue("monstersFile"));
loadXmlFile(paths.getStringValue("monstersPatchFile"));
-
- StringVect list;
- BeingCommon::getIncludeFiles(paths.getStringValue(
- "monstersPatchDir"), list);
- FOR_EACH (StringVectCIter, it, list)
- loadXmlFile(*it);
+ loadXmlDir("monstersPatchDir", loadXmlFile);
mLoaded = true;
}
diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp
index c8b29c9da..412de1a1b 100644
--- a/src/resources/db/npcdb.cpp
+++ b/src/resources/db/npcdb.cpp
@@ -49,12 +49,7 @@ void NPCDB::load()
loadXmlFile(paths.getStringValue("npcsFile"));
loadXmlFile(paths.getStringValue("npcsPatchFile"));
-
- StringVect list;
- BeingCommon::getIncludeFiles(paths.getStringValue(
- "npcsPatchDir"), list);
- FOR_EACH (StringVectCIter, it, list)
- loadXmlFile(*it);
+ loadXmlDir("npcsPatchDir", loadXmlFile);
mLoaded = true;
}
diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp
index 1d8e22d51..aef1b2bda 100644
--- a/src/resources/db/petdb.cpp
+++ b/src/resources/db/petdb.cpp
@@ -49,6 +49,7 @@ void PETDB::load()
logger->log1("Initializing PET database...");
loadXmlFile(paths.getStringValue("petsFile"));
loadXmlFile(paths.getStringValue("petsPatchFile"));
+ loadXmlDir("petsPatchDir", loadXmlFile);
mLoaded = true;
}
diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp
index a179eb2ff..ad98b2705 100644
--- a/src/resources/db/sounddb.cpp
+++ b/src/resources/db/sounddb.cpp
@@ -26,6 +26,8 @@
#include "utils/xml.h"
+#include "resources/beingcommon.h"
+
#include "debug.h"
namespace
@@ -39,6 +41,7 @@ void SoundDB::load()
unload();
loadXmlFile(paths.getStringValue("soundsFile"));
loadXmlFile(paths.getStringValue("soundsPatchFile"));
+ loadXmlDir("soundsPatchDir", loadXmlFile);
}
void SoundDB::loadXmlFile(const std::string &fileName)