diff options
author | Yohann Ferreira <bertram@cegetel.net> | 2005-02-23 16:45:09 +0000 |
---|---|---|
committer | Yohann Ferreira <bertram@cegetel.net> | 2005-02-23 16:45:09 +0000 |
commit | 8c195e6f12860e61509244cc3bcbf258555a85f2 (patch) | |
tree | 3d83a1557954ebcb312cb89e3e68545d555200a0 /src | |
parent | 32cd4fc75d9700c83117d69fb5aca294f3bae6ab (diff) | |
download | mana-8c195e6f12860e61509244cc3bcbf258555a85f2.tar.gz mana-8c195e6f12860e61509244cc3bcbf258555a85f2.tar.bz2 mana-8c195e6f12860e61509244cc3bcbf258555a85f2.tar.xz mana-8c195e6f12860e61509244cc3bcbf258555a85f2.zip |
New Skill dialog didn't respected the C++ ISO.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/newskill.cpp | 47 | ||||
-rw-r--r-- | src/gui/newskill.h | 6 |
2 files changed, 28 insertions, 25 deletions
diff --git a/src/gui/newskill.cpp b/src/gui/newskill.cpp index 478f9d57..b9f33310 100644 --- a/src/gui/newskill.cpp +++ b/src/gui/newskill.cpp @@ -70,16 +70,16 @@ char *skill_name[] = { NewSkillDialog::NewSkillDialog(): Window("Skills") { - skillLabel = new gcn::Label[N_SKILL_CAT_SIZE]("Empty "); - skillLevel = new gcn::Label[N_SKILL_CAT_SIZE]("00000"); - skillbar = new ProgressBar[N_SKILL_CAT_SIZE](0.0f,0,0,270,15,0,0,255); - startPoint = 0; - for(int a=0;a<N_SKILL_CAT_SIZE;a++) + startPoint = 0; + for ( int i = 0; i < N_SKILL_CAT_SIZE; i++) { - skillLevel[a].setAlignment(Graphics::RIGHT); - add(&skillLabel[a],40,50+a*20); - add(&skillLevel[a],200,50+a*20); - add(&skillbar[a],250,50+a*20); + skillLabel[i] = new gcn::Label("Empty "); + skillLevel[i] = new gcn::Label("00000"); + skillbar[i] = new ProgressBar(0.0f,0,0,270,15,0,0,255); + skillLevel[i]->setAlignment(Graphics::RIGHT); + add(skillLabel[i],40,50+i*20); + add(skillLevel[i],200,50+i*20); + add(skillbar[i],250,50+i*20); } // initialize the skills for(int i=0;i<N_SKILL;i++) @@ -168,10 +168,13 @@ NewSkillDialog::NewSkillDialog(): NewSkillDialog::~NewSkillDialog() { - delete skillbar; - delete []skillLabel; - delete closeButton; - delete []catButton; + // You don't have to delete children widgets. + // GUIchan will do it. + //delete skillbar; + //delete []skillLabel; + //delete []skillLevel; + //delete closeButton; + //delete []catButton; } void NewSkillDialog::action(const std::string& eventId) @@ -229,20 +232,20 @@ void NewSkillDialog::resetNSD() { if(skill_name[a+startPoint] != "") { - skillLabel[a].setCaption(skill_name[a+startPoint]); - skillLabel[a].setVisible(true); + skillLabel[a]->setCaption(skill_name[a+startPoint]); + skillLabel[a]->setVisible(true); char tmp[5]; sprintf(tmp, "%d",playerSkill[a+startPoint].level); - skillLevel[a].setCaption(tmp); - skillLevel[a].setVisible(true); - skillbar[a].setProgress(0.0f); - skillbar[a].setVisible(true); + skillLevel[a]->setCaption(tmp); + skillLevel[a]->setVisible(true); + skillbar[a]->setProgress(0.0f); + skillbar[a]->setVisible(true); } else { - skillLevel[a].setVisible(false); - skillLabel[a].setVisible(false); - skillbar[a].setVisible(false); + skillLevel[a]->setVisible(false); + skillLabel[a]->setVisible(false); + skillbar[a]->setVisible(false); } } } diff --git a/src/gui/newskill.h b/src/gui/newskill.h index 57d09d77..743adbd0 100644 --- a/src/gui/newskill.h +++ b/src/gui/newskill.h @@ -42,9 +42,9 @@ class NewSkillDialog : public Window, public gcn::ActionListener private: // members int startPoint; // starting point of skill listing - ProgressBar *skillbar; - gcn::Label *skillLabel; - gcn::Label *skillLevel; + ProgressBar *skillbar[N_SKILL_CAT_SIZE]; + gcn::Label *skillLabel[N_SKILL_CAT_SIZE]; + gcn::Label *skillLevel[N_SKILL_CAT_SIZE]; gcn::Button *catButton[N_SKILL_CAT]; gcn::Button *closeButton; nSkill playerSkill[N_SKILL]; // pointer to an array of skill values |