summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-05 12:43:27 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:57 +0300
commit617feef91574c9ad6dc6dcddf910566f394c9981 (patch)
tree8b428e1c79081519a921d0d3b0b4ff67c52cd934 /src/gui
parenta165e5d78010cd1cfedc8bdc320fd7084d58ba2b (diff)
downloadplus-617feef91574c9ad6dc6dcddf910566f394c9981.tar.gz
plus-617feef91574c9ad6dc6dcddf910566f394c9981.tar.bz2
plus-617feef91574c9ad6dc6dcddf910566f394c9981.tar.xz
plus-617feef91574c9ad6dc6dcddf910566f394c9981.zip
Enable skill use button based on skill type.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/skillinfo.h9
-rw-r--r--src/gui/windows/skilldialog.cpp15
2 files changed, 10 insertions, 14 deletions
diff --git a/src/gui/widgets/skillinfo.h b/src/gui/widgets/skillinfo.h
index 10d6191df..aa92b4bcb 100644
--- a/src/gui/widgets/skillinfo.h
+++ b/src/gui/widgets/skillinfo.h
@@ -65,10 +65,15 @@ struct SkillInfo final
void update();
- SkillData *getData(const int level) const;
- SkillData *getData1(const int level) const;
+ SkillData *getData(const int level) const A_WARN_UNUSED;
+ SkillData *getData1(const int level) const A_WARN_UNUSED;
void addData(const int level, SkillData *const data);
+
+ bool isUsable() const A_WARN_UNUSED
+ {
+ return type == SkillType::Attack || type == SkillType::Self;
+ }
};
typedef std::vector<SkillInfo*> SkillList;
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 5b70f685b..8784ded34 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -125,17 +125,8 @@ void SkillDialog::action(const ActionEvent &event)
{
if (const SkillInfo *const info = tab->getSelectedInfo())
{
- if (info && info->data && info->useButton.empty()
- && info->data->description.empty())
- {
- mUseButton->setEnabled(true);
- mUseButton->setCaption(_("Use"));
- }
- else
- {
- mUseButton->setEnabled(info->range > 0);
- mUseButton->setCaption(info->useButton);
- }
+ mUseButton->setEnabled(info->isUsable());
+ mUseButton->setCaption(info->useButton);
mIncreaseButton->setEnabled(info->id < SKILL_VAR_MIN_ID);
const int num = itemShortcutWindow->getTabIndex();
if (num >= 0 && num < static_cast<int>(SHORTCUT_TABS)
@@ -397,7 +388,7 @@ void SkillDialog::addSkill(const int id,
skill->skillLevel = strprintf(_("Lvl: %d"), level);
skill->range = range;
skill->update();
-
+ skill->useButton = _("Use");
mDefaultModel->addSkill(skill);
mSkills[id] = skill;