diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-01-19 17:16:42 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-01-19 17:16:42 +0200 |
commit | 2db104b657d0403f1b8ce2eb2dc8ada4ee9d7f73 (patch) | |
tree | 949e1ad112f95b686a03c39d7697b2ea2b9d4ca3 /src/gui/skilldialog.cpp | |
parent | 31dda9ab4d1559749a0f8f181ce1f7948e482813 (diff) | |
download | manaverse-2db104b657d0403f1b8ce2eb2dc8ada4ee9d7f73.tar.gz manaverse-2db104b657d0403f1b8ce2eb2dc8ada4ee9d7f73.tar.bz2 manaverse-2db104b657d0403f1b8ce2eb2dc8ada4ee9d7f73.tar.xz manaverse-2db104b657d0403f1b8ce2eb2dc8ada4ee9d7f73.zip |
Add unknown skills to first skill tab. (in tmw Basic).
Diffstat (limited to 'src/gui/skilldialog.cpp')
-rw-r--r-- | src/gui/skilldialog.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index fa4d5bdb2..b80f4b335 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -236,6 +236,7 @@ SkillDialog::SkillDialog(): mTabs = new TabbedArea(); mPointsLabel = new Label("0"); mIncreaseButton = new Button(_("Up"), "inc", this); + mDefaultModel = 0; place(0, 0, mTabs, 5, 5); place(0, 5, mPointsLabel, 4); @@ -336,6 +337,9 @@ void SkillDialog::loadSkills(const std::string &file) if (Net::getNetworkType() == ServerInfo::TMWATHENA) { SkillModel *model = new SkillModel(); + if (!mDefaultModel) + mDefaultModel = model; + SkillInfo *skill = new SkillInfo; skill->id = 1; skill->name = "basic"; @@ -374,6 +378,8 @@ void SkillDialog::loadSkills(const std::string &file) strprintf(_("Skill Set %d"), setCount)); SkillModel *model = new SkillModel(); + if (!mDefaultModel) + mDefaultModel = model; for_each_xml_child_node(node, set) { @@ -416,7 +422,7 @@ void SkillDialog::loadSkills(const std::string &file) update(); } -void SkillDialog::setModifiable(int id, bool modifiable) +bool SkillDialog::setModifiable(int id, bool modifiable) { SkillMap::iterator it = mSkills.find(id); @@ -428,6 +434,29 @@ void SkillDialog::setModifiable(int id, bool modifiable) info->modifiable = modifiable; info->update(); } + return true; + } + return false; +} + +void SkillDialog::addSkill(int id, int level, bool modifiable) +{ + if (mDefaultModel) + { + SkillInfo *skill = new SkillInfo; + skill->id = static_cast<short unsigned>(id); + skill->name = "Unknown skill Id: " + toString(id); + skill->setIcon(""); + skill->modifiable = modifiable; + skill->visible = false; + skill->model = mDefaultModel; + skill->skillLevel = level; + skill->update(); + + mDefaultModel->addSkill(skill); + + mSkills[id] = skill; + mDefaultModel->updateVisibilities(); } } |