summaryrefslogtreecommitdiff
path: root/src/gui/skilldialog.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-08-07 14:49:27 -0600
committerJared Adams <jaxad0127@gmail.com>2009-08-07 14:49:27 -0600
commit7a7018c517948c2cc567d28d221c5cd8a91f2c12 (patch)
treeb8513d4f47a6882e5a362541cd65a3cd477fc9fd /src/gui/skilldialog.cpp
parent8c5506d97c620aa83b11056dd6cb1ff332f9921c (diff)
downloadmana-7a7018c517948c2cc567d28d221c5cd8a91f2c12.tar.gz
mana-7a7018c517948c2cc567d28d221c5cd8a91f2c12.tar.bz2
mana-7a7018c517948c2cc567d28d221c5cd8a91f2c12.tar.xz
mana-7a7018c517948c2cc567d28d221c5cd8a91f2c12.zip
Clear tab data from SkillDialog
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();