summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);