summaryrefslogtreecommitdiff
path: root/src/gui/charcreatedialog.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-05 21:48:30 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-05 21:48:30 +0300
commit6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed (patch)
tree79a54d4c838c85df29b1b95702b71a95c43ceb5a /src/gui/charcreatedialog.cpp
parentd1bb1b375d657f0821ccfebf18fa1c3873314690 (diff)
downloadmanaverse-6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed.tar.gz
manaverse-6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed.tar.bz2
manaverse-6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed.tar.xz
manaverse-6fee84f3838bdd900e8cfc4a1e4d7f15f35bd6ed.zip
Improve constructors in some classes.
Diffstat (limited to 'src/gui/charcreatedialog.cpp')
-rw-r--r--src/gui/charcreatedialog.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index 4c553f5e1..37839c7ee 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -67,8 +67,37 @@ static const uint8_t directions[] =
CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
const int slot) :
Window(_("New Character"), true, parent, "charcreate.xml"),
+ ActionListener(),
+ KeyListener(),
mCharSelectDialog(parent),
+ mNameField(new TextField("")),
+ mNameLabel(new Label(_("Name:"))),
+ // TRANSLATORS: This is a narrow symbol used to denote 'next'.
+ // You may change this symbol if your language uses another.
+ mNextHairColorButton(new Button(_(">"), "nextcolor", this)),
+ // TRANSLATORS: This is a narrow symbol used to denote 'previous'.
+ // You may change this symbol if your language uses another.
+ mPrevHairColorButton(new Button(_("<"), "prevcolor", this)),
+ mHairColorLabel(new Label(_("Hair color:"))),
+ mHairColorNameLabel(new Label("")),
+ mNextHairStyleButton(new Button(_(">"), "nextstyle", this)),
+ mPrevHairStyleButton(new Button(_("<"), "prevstyle", this)),
+ mHairStyleLabel(new Label(_("Hair style:"))),
+ mHairStyleNameLabel(new Label("")),
+ mActionButton(new Button(_("^"), "action", this)),
+ mRotateButton(new Button(_(">"), "rotate", this)),
+ mMale(new RadioButton(_("Male"), "gender")),
+ mFemale(new RadioButton(_("Female"), "gender")),
+ mOther(new RadioButton(_("Other"), "gender")),
+ mAttributesLeft(new Label(
+ strprintf(_("Please distribute %d points"), 99))),
+ mMaxPoints(0),
+ mUsedPoints(0),
+ mCreateButton(new Button(_("Create"), "create", this)),
+ mCancelButton(new Button(_("Cancel"), "cancel", this)),
mRace(0),
+ mPlayer(new Being(0, ActorSprite::PLAYER, mRace, nullptr)),
+ mPlayerBox(new PlayerBox(mPlayer, "charcreate_playerbox.xml")),
mSlot(slot),
mAction(0),
mDirection(0)
@@ -77,7 +106,6 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
setSticky(true);
setWindowName("NewCharacter");
- mPlayer = new Being(0, ActorSprite::PLAYER, mRace, nullptr);
mPlayer->setGender(GENDER_MALE);
const std::vector<int> &items = CharDB::getDefaultItems();
int i = 1;
@@ -101,23 +129,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mHairStyle = (rand() % maxHairStyle) + minHairStyle;
mHairColor = (rand() % maxHairColor) + minHairColor;
- mNameField = new TextField("");
mNameField->setMaximum(24);
- mNameLabel = new Label(_("Name:"));
- // TRANSLATORS: This is a narrow symbol used to denote 'next'.
- // You may change this symbol if your language uses another.
- mNextHairColorButton = new Button(_(">"), "nextcolor", this);
- // TRANSLATORS: This is a narrow symbol used to denote 'previous'.
- // You may change this symbol if your language uses another.
- mPrevHairColorButton = new Button(_("<"), "prevcolor", this);
- mHairColorLabel = new Label(_("Hair color:"));
- mHairColorNameLabel = new Label("");
- mNextHairStyleButton = new Button(_(">"), "nextstyle", this);
- mPrevHairStyleButton = new Button(_("<"), "prevstyle", this);
- mHairStyleLabel = new Label(_("Hair style:"));
- mHairStyleNameLabel = new Label("");
- mActionButton = new Button(_("^"), "action", this);
- mRotateButton = new Button(_(">"), "rotate", this);
if (serverVersion >= 2)
{
@@ -127,12 +139,6 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mRaceNameLabel = new Label("");
}
- mCreateButton = new Button(_("Create"), "create", this);
- mCancelButton = new Button(_("Cancel"), "cancel", this);
- mMale = new RadioButton(_("Male"), "gender");
- mFemale = new RadioButton(_("Female"), "gender");
- mOther = new RadioButton(_("Other"), "gender");
-
// Default to a Male character
mMale->setSelected(true);
@@ -144,14 +150,11 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent,
mFemale->addActionListener(this);
mOther->addActionListener(this);
- mPlayerBox = new PlayerBox(mPlayer, "charcreate_playerbox.xml");
mPlayerBox->setWidth(74);
mNameField->setActionEventId("create");
mNameField->addActionListener(this);
- mAttributesLeft = new Label(
- strprintf(_("Please distribute %d points"), 99));
const int w = 480;
const int h = 350;