summaryrefslogtreecommitdiff
path: root/src/gui/skill.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/skill.cpp')
-rw-r--r--src/gui/skill.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 064354cd..fc791cd5 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -80,7 +80,7 @@ SkillDialog::SkillDialog():
skillScrollArea->setDimension(gcn::Rectangle(5, 5, 230, 180));
pointsLabel->setDimension(gcn::Rectangle(8, 190, 200, 16));
incButton->setPosition(skillScrollArea->getX(), 210);
- useButton->setPosition(incButton->getX() + incButton->getWidth() + 10,
+ useButton->setPosition(incButton->getX() + incButton->getWidth() + 5,
210);
closeButton->setPosition(
skillScrollArea->getX() + skillScrollArea->getWidth() - closeButton->getWidth(),
@@ -129,6 +129,18 @@ void SkillDialog::action(const std::string& eventId)
WFIFOSET(4);
}
}
+ else if (eventId == "use")
+ {
+ // Use skill
+ int selectedSkill = skillListBox->getSelected();
+ if (selectedSkill >= 0)
+ {
+ WFIFOW(0) = net_w_value(0x0113);
+ WFIFOW(2) = 0;
+ WFIFOW(4) = net_w_value(skillList[selectedSkill]->id);
+ WFIFOL(6) = net_l_value(0);
+ }
+ }
else if (eventId == "skill")
{
incButton->setEnabled(
@@ -202,3 +214,12 @@ void SkillDialog::setSkill(int id, int lv, int sp)
}
}
}
+
+void SkillDialog::cleanList()
+{
+ for (int i = skillList.size() - 1; i >= 0; i--)
+ {
+ delete skillList[i];
+ skillList.pop_back();
+ }
+}