diff options
Diffstat (limited to 'src/game-server/specialmanager.cpp')
-rw-r--r-- | src/game-server/specialmanager.cpp | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/src/game-server/specialmanager.cpp b/src/game-server/specialmanager.cpp index 39616faa..0840d25a 100644 --- a/src/game-server/specialmanager.cpp +++ b/src/game-server/specialmanager.cpp @@ -36,6 +36,39 @@ static SpecialManager::TargetMode getTargetByString(const std::string &str) return SpecialManager::TARGET_BEING; } + +/** + * Read a <special> element from settings. + * Used by SettingsManager. + */ +void SpecialManager::readSpecialSetNode(xmlNodePtr node, const std::string &filename) +{ + std::string setName = XML::getProperty(node, "name", std::string()); + if (setName.empty()) + { + LOG_WARN("The " << filename << " file contains unamed <set> tags and will be ignored."); + return; + } + + setName = utils::toLower(setName); + + for_each_xml_child_node(specialNode, node) + { + if (xmlStrEqual(specialNode->name, BAD_CAST "special")) { + readSpecialNode(specialNode, setName); + } + } + +} + +/** + * Check the status of recently loaded configuration. + */ +void SpecialManager::checkStatus() +{ + LOG_INFO("Loaded " << mSpecialsInfo.size() << " specials"); +} + void SpecialManager::readSpecialNode(xmlNodePtr specialNode, const std::string &setName) { @@ -94,42 +127,11 @@ void SpecialManager::readSpecialNode(xmlNodePtr specialNode, void SpecialManager::initialize() { clear(); +} - XML::Document doc(mSpecialFile); - xmlNodePtr rootNode = doc.rootNode(); - - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "specials")) - { - LOG_ERROR("Special Manager: " << mSpecialFile - << " is not a valid database file!"); - return; - } - - LOG_INFO("Loading special reference: " << mSpecialFile); - - for_each_xml_child_node(setNode, rootNode) - { - // The server will prefix the core name with the set, so we need one. - if (!xmlStrEqual(setNode->name, BAD_CAST "set")) - continue; - - std::string setName = XML::getProperty(setNode, "name", std::string()); - if (setName.empty()) - { - LOG_WARN("The " << mSpecialFile << " file is containing unamed <set> " - "tags and will be ignored."); - continue; - } - - setName = utils::toLower(setName); - - for_each_xml_child_node(specialNode, setNode) - { - if (!xmlStrEqual(specialNode->name, BAD_CAST "special")) - continue; - readSpecialNode(specialNode, setName); - } - } +void SpecialManager::reload() +{ + clear(); } void SpecialManager::clear() |