summaryrefslogtreecommitdiff
path: root/src/gui/skill.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-07 16:17:00 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-07 16:17:00 +0000
commitc96bbebb4b225e1e76297a93cd85f91ac4e92273 (patch)
tree939488b5924cdd0ed2296af64fdda637ebd0abf4 /src/gui/skill.cpp
parent660d3a52aa1bdcbac012a99db8f78642085b6cc8 (diff)
downloadmana-c96bbebb4b225e1e76297a93cd85f91ac4e92273.tar.gz
mana-c96bbebb4b225e1e76297a93cd85f91ac4e92273.tar.bz2
mana-c96bbebb4b225e1e76297a93cd85f91ac4e92273.tar.xz
mana-c96bbebb4b225e1e76297a93cd85f91ac4e92273.zip
Changed version from 0.0.11a to 0.0.11.1. Also made "+" buttons on stats window
and "Up" button on skills window disable when appropriate.
Diffstat (limited to 'src/gui/skill.cpp')
-rw-r--r--src/gui/skill.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index c342582f..8c22af55 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -55,7 +55,8 @@ char *skill_db[] = {
SkillDialog::SkillDialog():
- Window("Skills")
+ Window("Skills"),
+ skillPoints(0)
{
skillListBox = new ListBox(this);
skillScrollArea = new ScrollArea(skillListBox);
@@ -63,6 +64,7 @@ SkillDialog::SkillDialog():
incButton = new Button(" Up ");
closeButton = new Button("Close");
+ skillListBox->setEventId("skill");
incButton->setEventId("inc");
closeButton->setEventId("close");
@@ -77,6 +79,7 @@ SkillDialog::SkillDialog():
add(incButton);
add(closeButton);
+ skillListBox->addActionListener(this);
incButton->addActionListener(this);
closeButton->addActionListener(this);
@@ -106,13 +109,20 @@ void SkillDialog::action(const std::string& eventId)
int selectedSkill = skillListBox->getSelected();
std::cout << "SkillDialog::action(" << selectedSkill << ")\n";
if (char_info->skill_point > 0 && selectedSkill >= 0) {
- std::cout << "Sending upgrade of id " << skillList[selectedSkill]->id << "\n";
+ std::cout << "Sending upgrade of id " <<
+ skillList[selectedSkill]->id << "\n";
WFIFOW(0) = net_w_value(0x0112);
WFIFOW(2) = net_w_value(
skillList[selectedSkill]->id);
WFIFOSET(4);
}
}
+ else if (eventId == "skill")
+ {
+ incButton->setEnabled(
+ skillListBox->getSelected() > -1 &&
+ skillPoints > 0);
+ }
else if (eventId == "close")
{
setVisible(false);
@@ -121,11 +131,15 @@ void SkillDialog::action(const std::string& eventId)
void SkillDialog::setPoints(int i)
{
- char tmp[128];
- sprintf(tmp, "Skill points: %i", i);
+ skillPoints = i;
+
if (pointsLabel != NULL) {
+ char tmp[128];
+ sprintf(tmp, "Skill points: %i", skillPoints);
pointsLabel->setCaption(tmp);
}
+
+ incButton->setEnabled(skillListBox->getSelected() > -1 && skillPoints > 0);
}
int SkillDialog::getNumberOfElements()