summaryrefslogtreecommitdiff
path: root/src/gui/skilldialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r--src/gui/skilldialog.cpp16
1 files changed, 14 insertions, 2 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();