From 463d5c603ea95f478dff4b12fbca3c7dd05cc8b9 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 6 Jan 2014 20:43:46 +0300 Subject: add ability to inlude config parts from subdirs for most dbs. --- src/resources/db/avatardb.cpp | 2 ++ src/resources/db/colordb.cpp | 9 +++++++++ src/resources/db/deaddb.cpp | 3 +++ src/resources/db/emotedb.cpp | 3 +++ src/resources/db/mapdb.cpp | 3 +++ src/resources/db/monsterdb.cpp | 7 +------ src/resources/db/npcdb.cpp | 7 +------ src/resources/db/petdb.cpp | 1 + src/resources/db/sounddb.cpp | 3 +++ 9 files changed, 26 insertions(+), 12 deletions(-) (limited to 'src/resources/db') 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) -- cgit v1.2.3-70-g09d2