diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/skill.cpp | 16 | ||||
-rw-r--r-- | src/gui/skill.h | 3 | ||||
-rw-r--r-- | src/gui/stats.cpp | 56 | ||||
-rw-r--r-- | src/gui/stats.h | 83 |
4 files changed, 79 insertions, 79 deletions
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index f2bf610c..88e16047 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -77,7 +77,10 @@ std::string SkillListModel::getElementAt(int i) { //return skill_db[skillList[i]->id]; char tmp[128]; - sprintf(tmp, "%s Lv: %i Sp: %i", skill_db[skillList[i]->id], skillList[i]->lv, skillList[i]->sp); + sprintf(tmp, "%s Lv: %i Sp: %i", + skill_db[skillList[i]->id], + skillList[i]->lv, + skillList[i]->sp); return tmp; } return ""; @@ -158,6 +161,12 @@ void SkillDialog::action(const std::string& eventId) if (eventId == "inc") { //increment skill + //if (char_info->skill_point > 0) { + // WFIFOW(0) = net_w_value(0x0112); + // WFIFOW(2) = net_w_value( + // get_skill_id(skill_list_dialog[3].d1)); + // WFIFOSET(4); + //} } else if (eventId == "close") { @@ -165,6 +174,11 @@ void SkillDialog::action(const std::string& eventId) } } +SkillListModel* SkillDialog::getModel() +{ + return skills; +} + void SkillDialog::setPoints(int i) { char tmp[128]; diff --git a/src/gui/skill.h b/src/gui/skill.h index dd3772cc..1d68bffe 100644 --- a/src/gui/skill.h +++ b/src/gui/skill.h @@ -89,7 +89,8 @@ class SkillDialog : public Window, public gcn::ActionListener ~SkillDialog(); void action(const std::string&); - SkillListModel* getModel() { return skills; } + + SkillListModel* getModel(); void setPoints(int i); }; diff --git a/src/gui/stats.cpp b/src/gui/stats.cpp index c5a3ebbd..7e9f6924 100644 --- a/src/gui/stats.cpp +++ b/src/gui/stats.cpp @@ -26,22 +26,20 @@ extern PLAYER_INFO *char_info; StatsWindow::StatsWindow(): - Window("Stats") + Window("Stats") { // New labels for (i = 0; i < 6; i++) { statsLabel[i] = new gcn::Label(); - statsDisplayLabel[i] = new gcn::Label(); + statsDisplayLabel[i] = new gcn::Label(); } remainingStatsPointsLabel = new gcn::Label(); - - update(); - + // New buttons for (i = 0; i < 6; i++) { statsButton[i] = new Button("+"); } - + // Set button events Id statsButton[0]->setEventId("STR"); statsButton[1]->setEventId("AGI"); @@ -49,24 +47,26 @@ StatsWindow::StatsWindow(): statsButton[3]->setEventId("INT"); statsButton[4]->setEventId("DEX"); statsButton[5]->setEventId("LUK"); - + // Set position for (i = 0; i < 6; i++) { statsLabel[i]->setPosition(10,(i*23)+10); - statsDisplayLabel[i]->setPosition(120,(i*23)+10); + statsDisplayLabel[i]->setPosition(120,(i*23)+10); statsButton[i]->setPosition(170,(i*23)+10); } remainingStatsPointsLabel->setPosition(10, 156); - + // Assemble for(i = 0; i < 6; i++) { add(statsLabel[i]); - add(statsDisplayLabel[i]); + add(statsDisplayLabel[i]); add(statsButton[i]); statsButton[i]->addActionListener(this); } add(remainingStatsPointsLabel); - + + update(); + setSize(200, 180); setLocationRelativeTo(getParent()); } @@ -75,7 +75,7 @@ void StatsWindow::update(){ std::stringstream statsStr[6]; std::stringstream figureStr[6]; std::stringstream remainingStatsPointsStr; - + statsStr[0] << "Strength:"; figureStr[0] << (int)char_info->STR; statsStr[1] << "Agility:"; @@ -88,17 +88,17 @@ void StatsWindow::update(){ figureStr[4] << (int)char_info->DEX; statsStr[5] << "Luck:"; figureStr[5] << (int)char_info->LUK; - + // for testing only... - + //remainingStatsPointsStr << "Remaining Status Points : " << char_info->statsPointsToAttribute; - + // Update labels for (i = 0; i < 6; i++) { statsLabel[i]->setCaption(statsStr[i].str()); statsLabel[i]->adjustSize(); - statsDisplayLabel[i]->setCaption(figureStr[i].str()); - statsDisplayLabel[i]->adjustSize(); + statsDisplayLabel[i]->setCaption(figureStr[i].str()); + statsDisplayLabel[i]->adjustSize(); } remainingStatsPointsLabel->setCaption(remainingStatsPointsStr.str()); remainingStatsPointsLabel->adjustSize(); @@ -107,26 +107,15 @@ void StatsWindow::update(){ StatsWindow::~StatsWindow() { for (int i = 0; i < 6; i++) { delete statsLabel[i]; - delete statsDisplayLabel[i]; + delete statsDisplayLabel[i]; delete statsButton[i]; - delete remainingStatsPointsLabel; } -} - -StatsWindow *StatsWindow::ptr = NULL; -StatsWindow *StatsWindow::create_statswindow() { - if (ptr == NULL) { - ptr = new StatsWindow(); - } - else { - ptr->setVisible(true); - } - return ptr; + delete remainingStatsPointsLabel; } void StatsWindow::action(const std::string& eventId) { WFIFOW(0) = net_w_value(0x00bb); - + if (eventId == "STR") { WFIFOW(2) = net_w_value(0x000d); } @@ -145,7 +134,8 @@ void StatsWindow::action(const std::string& eventId) { if (eventId == "LUK") { WFIFOW(2) = net_w_value(0x0012); } - + flush(); - update(); + WFIFOW(4) = net_b_value(1); + WFIFOSET(5); } diff --git a/src/gui/stats.h b/src/gui/stats.h index b730aefb..a220f125 100644 --- a/src/gui/stats.h +++ b/src/gui/stats.h @@ -32,51 +32,46 @@ #include <sstream> class StatsWindow : public Window, public gcn::ActionListener { - public: - /** - * Creates the Stats window. - */ - static StatsWindow *create_statswindow(); - - /** - * Called when receiving actions from widget. - */ - void action(const std::string& eventId); - - /** - * Updates stats in window. - */ - void update(); - - private: - int i; + public: + /** + * Constructor. + */ + StatsWindow(); - /** - * Stats captions. - */ - gcn::Label *statsLabel[6]; - gcn::Label *statsDisplayLabel[6]; - gcn::Label *remainingStatsPointsLabel; - - /** - * Stats buttons. - */ - Button *statsButton[6]; - - /** - * Stats window ptr. - */ - static StatsWindow *ptr; - - /** - * Constructor. - */ - StatsWindow(); - - /** - * Destructor. - */ - virtual ~StatsWindow(); + /** + * Destructor. + */ + virtual ~StatsWindow(); + + /** + * Called when receiving actions from widget. + */ + void action(const std::string& eventId); + + /** + * Updates stats in window. + */ + void update(); + + private: + int i; + + /** + * Stats captions. + */ + gcn::Label *statsLabel[6]; + gcn::Label *statsDisplayLabel[6]; + gcn::Label *remainingStatsPointsLabel; + + /** + * Stats buttons. + */ + Button *statsButton[6]; + + /** + * Stats window ptr. + */ + static StatsWindow *ptr; }; #endif /* _TMW_STATS_WINDOW_H */ |