diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-16 17:20:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-16 22:33:53 +0300 |
commit | ade168344165534061b8f184866e2808af7f5d48 (patch) | |
tree | 7316b20df44434085b4649453f07ce9702261c98 /src/gui/skilldialog.cpp | |
parent | 08f2ee6470104c959f686504cc4324aee78cecaf (diff) | |
download | manaverse-ade168344165534061b8f184866e2808af7f5d48.tar.gz manaverse-ade168344165534061b8f184866e2808af7f5d48.tar.bz2 manaverse-ade168344165534061b8f184866e2808af7f5d48.tar.xz manaverse-ade168344165534061b8f184866e2808af7f5d48.zip |
Simplify skills loading.
Also putting in defines legacy manaserv code.
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r-- | src/gui/skilldialog.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 9f484de8d..97e2fbdf1 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -264,7 +264,7 @@ SkillDialog::SkillDialog() : SkillDialog::~SkillDialog() { // Clear gui - loadSkills(""); + clearSkills(); } void SkillDialog::action(const gcn::ActionEvent &event) @@ -358,18 +358,20 @@ void SkillDialog::update() } } -void SkillDialog::loadSkills(const std::string &file) +void SkillDialog::clearSkills() { mTabs->removeAll(); - delete_all(mSkills); mSkills.clear(); +} - if (file.length() == 0) - return; +void SkillDialog::loadSkills() +{ + clearSkills(); - XML::Document doc(file); - const XmlNodePtr root = doc.rootNode(); + XML::Document doc("ea-skills.xml"); + XML::Document doc2("skills.xml"); + XmlNodePtr root = doc.rootNode(); int setCount = 0; std::string setName; @@ -378,10 +380,15 @@ void SkillDialog::loadSkills(const std::string &file) SkillTab *tab; if (!root || !xmlNameEqual(root, "skills")) + root = doc2.rootNode(); + + if (!root || !xmlNameEqual(root, "skills")) { - logger->log("Error loading skills file: %s", file.c_str()); + logger->log("Error loading skills"); +#ifdef MANASERV_SUPPORT if (Net::getNetworkType() != ServerInfo::MANASERV) +#endif { SkillModel *const model = new SkillModel(); if (!mDefaultModel) |