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 | |
parent | 08f2ee6470104c959f686504cc4324aee78cecaf (diff) | |
download | plus-ade168344165534061b8f184866e2808af7f5d48.tar.gz plus-ade168344165534061b8f184866e2808af7f5d48.tar.bz2 plus-ade168344165534061b8f184866e2808af7f5d48.tar.xz plus-ade168344165534061b8f184866e2808af7f5d48.zip |
Simplify skills loading.
Also putting in defines legacy manaserv code.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/skilldialog.cpp | 23 | ||||
-rw-r--r-- | src/gui/skilldialog.h | 4 |
2 files changed, 18 insertions, 9 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) diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h index 9e956703a..945ae318d 100644 --- a/src/gui/skilldialog.h +++ b/src/gui/skilldialog.h @@ -108,7 +108,9 @@ class SkillDialog final : public Window, public gcn::ActionListener */ void update(); - void loadSkills(const std::string &file); + void clearSkills(); + + void loadSkills(); bool updateSkill(const int id, const int range, const bool modifiable); |