summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-02-10 09:52:17 +0000
committerJared Adams <jaxad0127@gmail.com>2009-02-10 09:53:17 +0000
commit53840c3fe951c77fa7965efcac4ed77b52da14d9 (patch)
tree7ed1ed095d6d5054008a189c18c7530ef5272705 /src
parent9b4febf79ecd220807d4a462d5945aa0aa561269 (diff)
downloadmana-client-53840c3fe951c77fa7965efcac4ed77b52da14d9.tar.gz
mana-client-53840c3fe951c77fa7965efcac4ed77b52da14d9.tar.bz2
mana-client-53840c3fe951c77fa7965efcac4ed77b52da14d9.tar.xz
mana-client-53840c3fe951c77fa7965efcac4ed77b52da14d9.zip
Disable increase button for fixed skills
Diffstat (limited to 'src')
-rw-r--r--src/gui/skill.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index c4f8737b..5cf8c51f 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -45,6 +45,11 @@ struct SkillInfo {
bool modifiable;
};
+static const SkillInfo fakeSkillInfo = {
+ _("Mystery Skill"),
+ false
+};
+
std::vector<SkillInfo> skill_db;
static void initSkillinfo();
@@ -80,11 +85,6 @@ public:
virtual void update()
{
- static const SkillInfo fakeSkillInfo = {
- _("Mystery Skill"),
- false
- };
-
mEntriesNr = mDialog->getSkills().size();
resize();
@@ -174,10 +174,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);