summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-26 15:47:39 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-26 15:47:39 +0300
commit9fe86d302838c62034c0bf6c74d8ca47722bd40b (patch)
tree58aa24b936547f3489788d5afb1045c89d5029fa /src/resources
parent61e3fa8513c1bc2644348ac6052ab87785fb119d (diff)
downloadmv-9fe86d302838c62034c0bf6c74d8ca47722bd40b.tar.gz
mv-9fe86d302838c62034c0bf6c74d8ca47722bd40b.tar.bz2
mv-9fe86d302838c62034c0bf6c74d8ca47722bd40b.tar.xz
mv-9fe86d302838c62034c0bf6c74d8ca47722bd40b.zip
dehardcode client data configuration file names.
Now names stored in paths.xml
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/avatardb.cpp5
-rw-r--r--src/resources/chardb.cpp8
-rw-r--r--src/resources/colordb.cpp12
-rw-r--r--src/resources/emotedb.cpp9
-rw-r--r--src/resources/itemdb.cpp7
-rw-r--r--src/resources/mapdb.cpp4
-rw-r--r--src/resources/monsterdb.cpp5
-rw-r--r--src/resources/npcdb.cpp8
-rw-r--r--src/resources/petdb.cpp8
-rw-r--r--src/resources/sounddb.cpp3
10 files changed, 42 insertions, 27 deletions
diff --git a/src/resources/avatardb.cpp b/src/resources/avatardb.cpp
index 39b1184fb..d610a14dc 100644
--- a/src/resources/avatardb.cpp
+++ b/src/resources/avatardb.cpp
@@ -46,12 +46,13 @@ void AvatarDB::load()
if (mLoaded)
unload();
- XML::Document doc("avatars.xml");
+ XML::Document doc(paths.getStringValue("avatarsFile"));
const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "avatars"))
{
- logger->log1("Avatars Database: Error while loading avatars.xml!");
+ logger->log("Avatars Database: Error while loading %s!",
+ paths.getStringValue("avatarsFile").c_str());
mLoaded = true;
return;
}
diff --git a/src/resources/chardb.cpp b/src/resources/chardb.cpp
index 4a9b35dbb..1111177e1 100644
--- a/src/resources/chardb.cpp
+++ b/src/resources/chardb.cpp
@@ -22,6 +22,7 @@
#include "resources/chardb.h"
#include "client.h"
+#include "configuration.h"
#include "logger.h"
#include "debug.h"
@@ -44,13 +45,14 @@ void CharDB::load()
if (mLoaded)
unload();
- XML::Document *doc = new XML::Document("charcreation.xml");
+ XML::Document *doc = new XML::Document(
+ paths.getStringValue("charCreationFile"));
const XmlNodePtr root = doc->rootNode();
if (!root || !xmlNameEqual(root, "chars"))
{
- logger->log1("CharDB: Failed to parse charcreation.xml.");
-
+ logger->log("CharDB: Failed to parse %s.",
+ paths.getStringValue("charCreationFile").c_str());
delete doc;
return;
}
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index ef7706cab..a71e8c639 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -22,6 +22,7 @@
#include "resources/colordb.h"
#include "client.h"
+#include "configuration.h"
#include "logger.h"
#include "utils/xml.h"
@@ -60,18 +61,20 @@ void ColorDB::loadHair()
if (it != mColorLists.end())
colors = it->second;
- XML::Document *doc = new XML::Document("hair.xml");
+ XML::Document *doc = new XML::Document(
+ paths.getStringValue("hairColorFile"));
XmlNodePtr root = doc->rootNode();
bool hairXml = true;
if (!root || !xmlNameEqual(root, "colors"))
{
- logger->log1("Trying to fall back on colors.xml");
+ logger->log("Trying to fall back on "
+ + paths.getStringValue("hairColorFile2"));
hairXml = false;
delete doc;
- doc = new XML::Document("colors.xml");
+ doc = new XML::Document(paths.getStringValue("hairColorFile2"));
root = doc->rootNode();
if (!root || !xmlNameEqual(root, "colors"))
@@ -108,7 +111,8 @@ void ColorDB::loadHair()
void ColorDB::loadColorLists()
{
- XML::Document *doc = new XML::Document("itemcolors.xml");
+ XML::Document *doc = new XML::Document(
+ paths.getStringValue("itemColorsFile"));
const XmlNodePtr root = doc->rootNode();
if (!root)
{
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index 09e3551dc..7361d99df 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -53,12 +53,13 @@ void EmoteDB::load()
logger->log1("Initializing emote database...");
- XML::Document doc("emotes.xml");
+ XML::Document doc(paths.getStringValue("emotesFile"));
XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "emotes"))
{
- logger->log1("Emote Database: Error while loading emotes.xml!");
+ logger->log("Emote Database: Error while loading %s!",
+ paths.getStringValue("emotesFile").c_str());
return;
}
@@ -75,8 +76,8 @@ void EmoteDB::load()
if (id == -1)
{
- logger->log1("Emote Database: Emote with missing ID in "
- "emotes.xml!");
+ logger->log("Emote Database: Emote with missing ID in %s!",
+ paths.getStringValue("emotesFile").c_str());
continue;
}
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 4643b5d76..cce475ae1 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -176,7 +176,7 @@ void ItemDB::load()
mUnknown->setSprite(errFile, GENDER_FEMALE, 0);
mUnknown->setSprite(errFile, GENDER_OTHER, 0);
mUnknown->addTag(mTags["All"]);
- loadXmlFile("items.xml", tagNum);
+ loadXmlFile(paths.getStringValue("itemsFile"), tagNum);
}
void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
@@ -186,7 +186,7 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
if (!rootNode || !xmlNameEqual(rootNode, "items"))
{
- logger->log("ItemDB: Error while loading items.xml!");
+ logger->log("ItemDB: Error while loading %s!", fileName.c_str());
mLoaded = true;
return;
}
@@ -207,7 +207,8 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
if (id == 0)
{
- logger->log1("ItemDB: Invalid or missing item ID in items.xml!");
+ logger->log("ItemDB: Invalid or missing item ID in %s!",
+ fileName.c_str());
continue;
}
else if (mItemInfos.find(id) != mItemInfos.end())
diff --git a/src/resources/mapdb.cpp b/src/resources/mapdb.cpp
index 621387175..d27d2f8ba 100644
--- a/src/resources/mapdb.cpp
+++ b/src/resources/mapdb.cpp
@@ -54,7 +54,7 @@ void MapDB::load()
void MapDB::loadRemap()
{
XML::Document *const doc = new XML::Document(
- paths.getStringValue("maps").append("remap.xml"));
+ paths.getStringValue("mapsRemapFile"));
const XmlNodePtr root = doc->rootNode();
if (!root)
@@ -119,7 +119,7 @@ void MapDB::readAtlas(XmlNodePtr node)
void MapDB::loadInfo()
{
- XML::Document *doc = new XML::Document("maps.xml");
+ XML::Document *doc = new XML::Document(paths.getStringValue("mapsFile"));
const XmlNodePtr root = doc->rootNode();
if (!root)
{
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index 9fcd2be0c..870b53fa5 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -50,12 +50,13 @@ void MonsterDB::load()
logger->log1("Initializing monster database...");
- XML::Document doc("monsters.xml");
+ XML::Document doc(paths.getStringValue("monstersFile"));
const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "monsters"))
{
- logger->log1("Monster Database: Error while loading monster.xml!");
+ logger->log("Monster Database: Error while loading %s!",
+ paths.getStringValue("monstersFile").c_str());
mLoaded = true;
return;
}
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 3f110d9d2..7b991e7d8 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -46,12 +46,13 @@ void NPCDB::load()
logger->log1("Initializing NPC database...");
- XML::Document doc("npcs.xml");
+ XML::Document doc(paths.getStringValue("npcsFile"));
const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "npcs"))
{
- logger->log1("NPC Database: Error while loading npcs.xml!");
+ logger->log("NPC Database: Error while loading %s!",
+ paths.getStringValue("npcsFile").c_str());
mLoaded = true;
return;
}
@@ -65,7 +66,8 @@ void NPCDB::load()
const int id = XML::getProperty(npcNode, "id", 0);
if (id == 0)
{
- logger->log1("NPC Database: NPC with missing ID in npcs.xml!");
+ logger->log("NPC Database: NPC with missing ID in %s!",
+ paths.getStringValue("npcsFile").c_str());
continue;
}
diff --git a/src/resources/petdb.cpp b/src/resources/petdb.cpp
index 055779d9d..806e20e72 100644
--- a/src/resources/petdb.cpp
+++ b/src/resources/petdb.cpp
@@ -46,12 +46,13 @@ void PETDB::load()
logger->log1("Initializing PET database...");
- XML::Document doc("pets.xml");
+ XML::Document doc(paths.getStringValue("petsFile"));
const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "pets"))
{
- logger->log1("PET Database: Error while loading pets.xml!");
+ logger->log("PET Database: Error while loading %s!",
+ paths.getStringValue("petsFile").c_str());
mLoaded = true;
return;
}
@@ -65,7 +66,8 @@ void PETDB::load()
const int id = XML::getProperty(petNode, "id", 0);
if (id == 0)
{
- logger->log1("PET Database: PET with missing ID in pets.xml!");
+ logger->log("PET Database: PET with missing ID in %s!",
+ paths.getStringValue("petsFile").c_str());
continue;
}
diff --git a/src/resources/sounddb.cpp b/src/resources/sounddb.cpp
index 9cf303322..beda71b88 100644
--- a/src/resources/sounddb.cpp
+++ b/src/resources/sounddb.cpp
@@ -21,6 +21,7 @@
#include "resources/sounddb.h"
#include "client.h"
+#include "configuration.h"
#include "logger.h"
#include "notifymanager.h"
@@ -38,7 +39,7 @@ void SoundDB::load()
{
unload();
- XML::Document *doc = new XML::Document("sounds.xml");
+ XML::Document *doc = new XML::Document(paths.getStringValue("soundsFile"));
XmlNodePtr root = doc->rootNode();
if (!root || !xmlNameEqual(root, "sounds"))