From d7b76809ac790e1adc61df5c87f9a868fd9d674a Mon Sep 17 00:00:00 2001 From: Jan-Peter Nilsson Date: Fri, 5 Nov 2010 18:49:44 +0100 Subject: [PATCH] Remove unnecessary member variables from SelectAttributeDialog --- apps/openmw/mwgui/class.cpp | 30 +++++++----------------------- apps/openmw/mwgui/class.hpp | 2 -- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index cd31e1003..79a1604a1 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -800,31 +800,15 @@ SelectAttributeDialog::SelectAttributeDialog(MWWorld::Environment& environment, setText("LabelT", wm->getGameSettingString("sAttributesMenu1", "")); - getWidget(attribute0, "Attribute0"); - getWidget(attribute1, "Attribute1"); - getWidget(attribute2, "Attribute2"); - getWidget(attribute3, "Attribute3"); - getWidget(attribute4, "Attribute4"); - getWidget(attribute5, "Attribute5"); - getWidget(attribute6, "Attribute6"); - getWidget(attribute7, "Attribute7"); - - Widgets::MWAttributePtr attributes[8] = { - attribute0, - attribute1, - attribute2, - attribute3, - attribute4, - attribute5, - attribute6, - attribute7 - }; - for (int i = 0; i < 8; ++i) { - attributes[i]->setWindowManager(wm); - attributes[i]->setAttributeId(ESM::Attribute::attributeIds[i]); - attributes[i]->eventClicked = MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked); + Widgets::MWAttributePtr attribute; + char theIndex = '0'+i; + + getWidget(attribute, std::string("Attribute").append(1, theIndex)); + attribute->setWindowManager(wm); + attribute->setAttributeId(ESM::Attribute::attributeIds[i]); + attribute->eventClicked = MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked); } // TODO: These buttons should be managed by a Dialog class diff --git a/apps/openmw/mwgui/class.hpp b/apps/openmw/mwgui/class.hpp index 4ad8de495..e931a7e8f 100644 --- a/apps/openmw/mwgui/class.hpp +++ b/apps/openmw/mwgui/class.hpp @@ -214,8 +214,6 @@ namespace MWGui void onCancelClicked(MyGUI::Widget* _sender); private: - Widgets::MWAttributePtr attribute0, attribute1, attribute2, attribute3, - attribute4, attribute5, attribute6, attribute7; Widgets::MWAttributePtr affectedWidget; ESM::Attribute::AttributeID attributeId;