summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp4
-rw-r--r--src/defaults.cpp23
-rw-r--r--src/effectmanager.cpp6
-rw-r--r--src/gui/equipmentwindow.cpp3
-rw-r--r--src/gui/questswindow.cpp2
-rw-r--r--src/gui/skilldialog.cpp4
-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
-rw-r--r--src/statuseffect.cpp4
-rw-r--r--src/units.cpp6
18 files changed, 80 insertions, 41 deletions
diff --git a/src/client.cpp b/src/client.cpp
index fd78d747e..395f148a6 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1425,7 +1425,7 @@ int Client::gameExec()
+ mUpdatesDir + "/local/", false);
}
- // Read default paths file 'data/paths.xml'
+ logger->log("Init paths");
paths.init("paths.xml", true);
paths.setDefaultValues(getPathsDefaults());
if (!SpriteReference::Empty)
@@ -2057,7 +2057,7 @@ void Client::initServerConfig(std::string serverName)
void Client::initFeatures() const
{
- features.init("features.xml", true);
+ features.init(paths.getStringValue("featuresFile"), true);
paths.setDefaultValues(getFeaturesDefaults());
}
diff --git a/src/defaults.cpp b/src/defaults.cpp
index f2229492d..11ebec96b 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -424,7 +424,6 @@ DefaultsData* getPathsDefaults()
AddDEF("minimaps", "graphics/minimaps/");
AddDEF("maps", "maps/");
-
AddDEF("sfx", "sfx/");
AddDEF("music", "music/");
@@ -433,6 +432,28 @@ DefaultsData* getPathsDefaults()
AddDEF("help", "help/");
+ AddDEF("statusEffectsFile", "status-effects.xml");
+ AddDEF("effectsFile", "effects.xml");
+ AddDEF("unitsFile", "units.xml");
+ AddDEF("featuresFile", "features.xml");
+ AddDEF("questsFile", "quests.xml");
+ AddDEF("skillsFile", "ea-skills.xml");
+ AddDEF("skillsFile2", "skills.xml");
+ AddDEF("equipmentWindowFile", "equipmentwindow.xml");
+ AddDEF("emotesFile", "emotes.xml");
+ AddDEF("hairColorFile", "hair.xml");
+ AddDEF("hairColorFile2", "colors.xml");
+ AddDEF("itemColorsFile", "itemcolors.xml");
+ AddDEF("charCreationFile", "charcreation.xml");
+ AddDEF("soundsFile", "sounds.xml");
+ AddDEF("itemsFile", "items.xml");
+ AddDEF("avatarsFile", "avatars.xml");
+ AddDEF("npcsFile", "npcs.xml");
+ AddDEF("petsFile", "pets.xml");
+ AddDEF("monstersFile", "monsters.xml");
+ AddDEF("mapsRemapFile", "maps/remap.xml");
+ AddDEF("mapsFile", "maps.xml");
+
return configData;
}
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp
index 52e848463..f76f3ebd0 100644
--- a/src/effectmanager.cpp
+++ b/src/effectmanager.cpp
@@ -23,6 +23,7 @@
#include "effectmanager.h"
#include "being.h"
+#include "configuration.h"
#include "logger.h"
#include "particle.h"
#include "soundmanager.h"
@@ -32,12 +33,13 @@
EffectManager::EffectManager() :
mEffects()
{
- XML::Document doc("effects.xml");
+ XML::Document doc(paths.getStringValue("effectsFile"));
const XmlNodePtr root = doc.rootNode();
if (!root || !xmlNameEqual(root, "being-effects"))
{
- logger->log1("Error loading being effects file: effects.xml");
+ logger->log("Error loading being effects file: "
+ + paths.getStringValue("effectsFile"));
return;
}
else
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index 802a08559..8511c7643 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -401,7 +401,8 @@ void EquipmentWindow::resetBeing(const Being *const being)
void EquipmentWindow::fillBoxes()
{
- XML::Document *const doc = new XML::Document("equipmentwindow.xml");
+ XML::Document *const doc = new XML::Document(
+ paths.getStringValue("equipmentWindowFile"));
const XmlNodePtr root = doc->rootNode();
if (!root)
{
diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp
index 541768fa7..42042e58f 100644
--- a/src/gui/questswindow.cpp
+++ b/src/gui/questswindow.cpp
@@ -222,7 +222,7 @@ QuestsWindow::~QuestsWindow()
void QuestsWindow::loadXml()
{
- XML::Document doc("quests.xml");
+ XML::Document doc(paths.getStringValue("questsFile"));
const XmlNodePtr root = doc.rootNode();
if (!root)
return;
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 693dc6c8b..6365efcd8 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -345,8 +345,8 @@ void SkillDialog::loadSkills()
{
clearSkills();
- XML::Document doc("ea-skills.xml");
- XML::Document doc2("skills.xml");
+ XML::Document doc(paths.getStringValue("skillsFile"));
+ XML::Document doc2(paths.getStringValue("skillsFile2"));
XmlNodePtr root = doc.rootNode();
int setCount = 0;
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"))
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 7d00eb5ab..9171028f7 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -33,8 +33,6 @@
#include "debug.h"
-static const char *const STATUS_EFFECTS_FILE = "status-effects.xml";
-
static void unloadMap(std::map<int, StatusEffect *> &map);
bool StatusEffect::mLoaded = false;
@@ -129,7 +127,7 @@ void StatusEffect::load()
if (mLoaded)
unload();
- XML::Document doc(STATUS_EFFECTS_FILE);
+ XML::Document doc(paths.getStringValue("statusEffectsFile"));
const XmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlNameEqual(rootNode, "status-effects"))
diff --git a/src/units.cpp b/src/units.cpp
index 93e051a89..957faa998 100644
--- a/src/units.cpp
+++ b/src/units.cpp
@@ -22,6 +22,7 @@
#include "units.h"
+#include "configuration.h"
#include "logger.h"
#include "utils/stringutils.h"
@@ -102,12 +103,13 @@ void Units::loadUnits()
units[UNIT_CURRENCY] = ud;
}
- XML::Document doc("units.xml");
+ XML::Document doc(paths.getStringValue("unitsFile"));
const XmlNodePtr root = doc.rootNode();
if (!root || !xmlNameEqual(root, "units"))
{
- logger->log1("Error loading unit definition file: units.xml");
+ logger->log("Error loading unit definition file: "
+ + paths.getStringValue("unitsFile"));
return;
}