diff options
-rw-r--r-- | src/gui/skilldialog.cpp | 16 | ||||
-rw-r--r-- | src/gui/skilldialog.h | 1 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index a27a2775..2f970184 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -47,7 +47,6 @@ #include "utils/xml.h" #include <string> -#include <vector> class SkillEntry; @@ -104,7 +103,8 @@ SkillDialog::SkillDialog(): SkillDialog::~SkillDialog() { - //delete_all(mTabs); + // Clear gui + loadSkills(""); } void SkillDialog::action(const gcn::ActionEvent &event) @@ -182,9 +182,21 @@ void SkillDialog::update() void SkillDialog::loadSkills(const std::string &file) { // TODO: mTabs->clear(); + while (mTabs->getSelectedTabIndex() != -1) + { + mTabs->removeTabWithIndex(mTabs->getSelectedTabIndex()); + } + + for (SkillMap::iterator it = mSkills.begin(); it != mSkills.end(); it++) + { + delete (*it).second->display; + } delete_all(mSkills); mSkills.clear(); + if (file.length() == 0) + return; + XML::Document doc(file); xmlNodePtr root = doc.rootNode(); diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h index ce8f091a..6ad28be4 100644 --- a/src/gui/skilldialog.h +++ b/src/gui/skilldialog.h @@ -28,7 +28,6 @@ #include <guichan/actionlistener.hpp> -#include <list> #include <map> class Label; |