diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-07-19 20:22:59 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2010-07-19 20:22:59 +0200 |
commit | 86eb0c08d233636cd4647649c6542d3cf410e3ab (patch) | |
tree | 9721759b41f0256f15c3786c357448a93215440e /src/configuration.cpp | |
parent | 335eec717f6189c01d8217dd2c4f4e74a171d9a5 (diff) | |
parent | 2d584d7e8aaeacbcb1036bae5c8deca9b810fe60 (diff) | |
download | mana-client-86eb0c08d233636cd4647649c6542d3cf410e3ab.tar.gz mana-client-86eb0c08d233636cd4647649c6542d3cf410e3ab.tar.bz2 mana-client-86eb0c08d233636cd4647649c6542d3cf410e3ab.tar.xz mana-client-86eb0c08d233636cd4647649c6542d3cf410e3ab.zip |
Merge branch '1.0'
Conflicts:
src/gui/itempopup.cpp
src/item.cpp
src/monster.cpp
src/net/manaserv/playerhandler.cpp
src/net/tmwa/partyhandler.cpp
src/npc.cpp
src/player.cpp
src/resources/itemdb.cpp
src/resources/monsterdb.cpp
src/resources/monsterinfo.cpp
src/resources/npcdb.cpp
src/resources/spritedef.cpp
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r-- | src/configuration.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp index 1310d642..d8b11034 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -137,33 +137,30 @@ void ConfigurationObject::initFromXML(xmlNodePtr parent_node) } } -void Configuration::init(const std::string &filename) +void Configuration::init(const std::string &filename, bool useResManager) { - mConfigPath = filename; + XML::Document doc(filename, useResManager); - // Do not attempt to read config from non-existant file - FILE *testFile = fopen(filename.c_str(), "r"); - if (!testFile) - return; + if (useResManager) + mConfigPath = "PhysFS://" + filename; else - fclose(testFile); - - xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0); + mConfigPath = filename; - if (!doc) return; + if (!doc.rootNode()) + { + logger->log("Couldn't open configuration file: %s", filename.c_str()); + return; + } - xmlNodePtr rootNode = xmlDocGetRootElement(doc); + xmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "configuration")) { logger->log("Warning: No configuration file (%s)", filename.c_str()); - xmlFreeDoc(doc); return; } initFromXML(rootNode); - - xmlFreeDoc(doc); } void ConfigurationObject::writeToXML(xmlTextWriterPtr writer) |