From f9cd8a5d6b4460ffcb945979d1e8cd8ebadc9b8d Mon Sep 17 00:00:00 2001 From: Przemysław Grzywacz Date: Wed, 22 May 2013 16:04:19 +0200 Subject: paths.xml content is now read from settings.xml --- src/client.cpp | 3 --- src/resources/itemdb.cpp | 12 ++++++------ src/resources/settingsmanager.cpp | 17 +++++++++++++++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 6b8ebca1..92c8c63a 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -755,9 +755,6 @@ int Client::exec() false); } - // Read default paths file 'data/paths.xml' - paths.init("paths.xml", true); - // TODO remove this as soon as inventoryhandler stops using this event Event::trigger(Event::ClientChannel, Event::LoadingDatabases); diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index b802457e..8c1a8d15 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -326,9 +326,6 @@ void TaItemDB::init() { if (mLoaded) unload(); - - mUnknown = new TaItemInfo; - loadEmptyItemDefinition(); } void TaItemDB::readItemNode(xmlNodePtr node, const std::string &filename) @@ -376,6 +373,9 @@ void TaItemDB::readItemNode(xmlNodePtr node, const std::string &filename) void TaItemDB::checkStatus() { + mUnknown = new TaItemInfo; + loadEmptyItemDefinition(); + checkHairWeaponsRacesSpecialIds(); mLoaded = true; @@ -417,9 +417,6 @@ void ManaServItemDB::init() // Initialize the trigger table for effect descriptions initTriggerTable(); - - mUnknown = new ManaServItemInfo; - loadEmptyItemDefinition(); } void ManaServItemDB::readItemNode(xmlNodePtr node, const std::string &filename) @@ -530,6 +527,9 @@ void ManaServItemDB::readItemNode(xmlNodePtr node, const std::string &filename) void ManaServItemDB::checkStatus() { + mUnknown = new ManaServItemInfo; + loadEmptyItemDefinition(); + mLoaded = true; } diff --git a/src/resources/settingsmanager.cpp b/src/resources/settingsmanager.cpp index b2d1fe80..940ebb59 100644 --- a/src/resources/settingsmanager.cpp +++ b/src/resources/settingsmanager.cpp @@ -20,6 +20,7 @@ #include "resources/settingsmanager.h" +#include "configuration.h" #include "resources/attributes.h" #include "resources/hairdb.h" #include "resources/itemdb.h" @@ -39,14 +40,15 @@ namespace SettingsManager { - std::string mSettingsFile; - std::set mIncludedFiles; + static std::string mSettingsFile; + static std::set mIncludedFiles; static void loadFile(const std::string &filename); void load() { // initialize managers + paths.clear(); Attributes::init(); hairDB.init(); itemDb->init(); @@ -140,6 +142,17 @@ namespace SettingsManager } } } + else if (xmlStrEqual(childNode->name, BAD_CAST "option")) + { + // options from paths.xml + std::string name = XML::getProperty(childNode, "name", std::string()); + std::string value = XML::getProperty(childNode, "value", std::string()); + + if (!name.empty()) + paths.setValue(name, value); + else + logger->log("Warning: option without a name found in %s", filename.c_str()); + } else if (xmlStrEqual(childNode->name, BAD_CAST "attribute")) { // map config -- cgit v1.2.3-70-g09d2