diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-04-07 16:17:00 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-04-07 16:17:00 +0000 |
commit | c96bbebb4b225e1e76297a93cd85f91ac4e92273 (patch) | |
tree | 939488b5924cdd0ed2296af64fdda637ebd0abf4 /src | |
parent | 660d3a52aa1bdcbac012a99db8f78642085b6cc8 (diff) | |
download | mana-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')
-rw-r--r-- | src/gui/skill.cpp | 22 | ||||
-rw-r--r-- | src/gui/skill.h | 1 | ||||
-rw-r--r-- | src/gui/stats.cpp | 12 |
3 files changed, 30 insertions, 5 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() diff --git a/src/gui/skill.h b/src/gui/skill.h index 5db90f04..c27f5ad2 100644 --- a/src/gui/skill.h +++ b/src/gui/skill.h @@ -48,6 +48,7 @@ class SkillDialog : public Window, public gcn::ActionListener, gcn::Button *closeButton; std::vector<SKILL*> skillList; + int skillPoints; public: /** diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp index 655e217a..9b134876 100644 --- a/src/gui/stats.cpp +++ b/src/gui/stats.cpp @@ -94,7 +94,9 @@ void StatsWindow::update(){ statsStr[5] << "Luck:"; figureStr[5] << (int)char_info->LUK; - remainingStatsPointsStr << "Remaining Status Points : " << char_info->statsPointsToAttribute; + int statusPoints = char_info->statsPointsToAttribute; + + remainingStatsPointsStr << "Remaining Status Points: " << statusPoints; pointsStr[0] << (int)char_info->STRUp; pointsStr[1] << (int)char_info->AGIUp; @@ -103,6 +105,14 @@ void StatsWindow::update(){ pointsStr[4] << (int)char_info->DEXUp; pointsStr[5] << (int)char_info->LUKUp; + // Enable buttons for which there are enough status points + statsButton[0]->setEnabled(char_info->STRUp <= statusPoints); + statsButton[1]->setEnabled(char_info->AGIUp <= statusPoints); + statsButton[2]->setEnabled(char_info->VITUp <= statusPoints); + statsButton[3]->setEnabled(char_info->INTUp <= statusPoints); + statsButton[4]->setEnabled(char_info->DEXUp <= statusPoints); + statsButton[5]->setEnabled(char_info->LUKUp <= statusPoints); + // Update labels for (i = 0; i < 6; i++) { statsLabel[i]->setCaption(statsStr[i].str()); |