diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-02-10 09:52:17 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-10 12:41:16 -0700 |
commit | 2ac3a8fb221391238ab4e23c7ee0c25f83cec97b (patch) | |
tree | bb184960b8c76eda381fb3758bac59d7ef62b285 /src/gui | |
parent | c674c0310d932f9cb76340a50dbcbe901daade12 (diff) | |
download | mana-2ac3a8fb221391238ab4e23c7ee0c25f83cec97b.tar.gz mana-2ac3a8fb221391238ab4e23c7ee0c25f83cec97b.tar.bz2 mana-2ac3a8fb221391238ab4e23c7ee0c25f83cec97b.tar.xz mana-2ac3a8fb221391238ab4e23c7ee0c25f83cec97b.zip |
Disable increase button for fixed skills
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/skill.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index dd7c3a4e..11db25ce 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -40,11 +40,14 @@ static const char *SKILLS_FILE = _("skills.xml"); -struct SkillInfo { +struct SkillInfo +{ std::string name; bool modifiable; }; +static const SkillInfo fakeSkillInfo = { _("???"), false }; + std::vector<SkillInfo> skill_db; static void initSkillinfo(void); @@ -80,8 +83,6 @@ public: virtual void update(void) { - static const SkillInfo fakeSkillInfo = { _("???"), false }; - mEntriesNr = mDialog->getSkills().size(); resize(); @@ -172,10 +173,18 @@ void SkillDialog::action(const gcn::ActionEvent &event) if (selectedSkill >= 0) player_node->raiseSkill(mSkillList[selectedSkill]->id); } - else if (event.getId() == "skill") + else if (event.getId() == "skill" && mTable->getSelectedRow() > -1) { - mIncButton->setEnabled(mTable->getSelectedRow() > -1 && - player_node->mSkillPoint > 0); + SKILL *skill = mSkillList[mTable->getSelectedRow()]; + SkillInfo const *info; + + if (skill->id >= 0 && (unsigned int) skill->id < skill_db.size()) + info = &skill_db[skill->id]; + else + info = &fakeSkillInfo; + + mIncButton->setEnabled(player_node->mSkillPoint > 0 && + info->modifiable); } else if (event.getId() == "close") setVisible(false); |