diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-03-14 03:56:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-03-14 04:06:13 +0300 |
commit | 112d2ad1904051160822d1845d1418cca889c0d5 (patch) | |
tree | 9731934d9dc367f931c028158f3d26a670e18feb /src/gui | |
parent | 02e9a62ce9a0f288804bfa2aa59c3a84b0376c4a (diff) | |
download | plus-112d2ad1904051160822d1845d1418cca889c0d5.tar.gz plus-112d2ad1904051160822d1845d1418cca889c0d5.tar.bz2 plus-112d2ad1904051160822d1845d1418cca889c0d5.tar.xz plus-112d2ad1904051160822d1845d1418cca889c0d5.zip |
Add support for other gender.
Fix per gender and race items separation.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/charcreatedialog.cpp | 16 | ||||
-rw-r--r-- | src/gui/charcreatedialog.h | 1 | ||||
-rw-r--r-- | src/gui/register.cpp | 25 | ||||
-rw-r--r-- | src/gui/register.h | 1 |
4 files changed, 37 insertions, 6 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index 124476f1c..0b20952c8 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -124,15 +124,18 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): 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); mMale->setActionEventId("gender"); mFemale->setActionEventId("gender"); + mOther->setActionEventId("gender"); mMale->addActionListener(this); mFemale->addActionListener(this); + mOther->addActionListener(this); mPlayerBox = new PlayerBox(mPlayer); mPlayerBox->setWidth(74); @@ -186,6 +189,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): mMale->setPosition(30, 120); mFemale->setPosition(100, 120); + mOther->setPosition(170, 120); add(mPlayerBox); add(mNameField); @@ -215,6 +219,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot): add(mMale); add(mFemale); + add(mOther); center(); setVisible(true); @@ -453,11 +458,19 @@ void CharCreateDialog::setFixedGender(bool fixed, Gender gender) { mFemale->setSelected(true); mMale->setSelected(false); + mOther->setSelected(false); } - else + else if (gender == GENDER_MALE) { + mFemale->setSelected(false); mMale->setSelected(true); + mOther->setSelected(false); + } + else + { mFemale->setSelected(false); + mMale->setSelected(false); + mOther->setSelected(true); } mPlayer->setGender(gender); @@ -466,6 +479,7 @@ void CharCreateDialog::setFixedGender(bool fixed, Gender gender) { mMale->setVisible(false); mFemale->setVisible(false); + mOther->setVisible(false); } } diff --git a/src/gui/charcreatedialog.h b/src/gui/charcreatedialog.h index ceafcc08e..8be421543 100644 --- a/src/gui/charcreatedialog.h +++ b/src/gui/charcreatedialog.h @@ -115,6 +115,7 @@ class CharCreateDialog : public Window, public gcn::ActionListener gcn::RadioButton *mMale; gcn::RadioButton *mFemale; + gcn::RadioButton *mOther; std::vector<gcn::Slider*> mAttributeSlider; std::vector<gcn::Label*> mAttributeLabel; diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 4f696dc9d..eebbfa603 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -67,6 +67,7 @@ RegisterDialog::RegisterDialog(LoginData *data): mEmailField(nullptr), mMaleButton(nullptr), mFemaleButton(nullptr), + mOtherButton(nullptr), mWrongDataNoticeListener(new WrongDataNoticeListener), mLoginData(data) { @@ -97,8 +98,18 @@ RegisterDialog::RegisterDialog(LoginData *data): { mMaleButton = new RadioButton(_("Male"), "sex", true); mFemaleButton = new RadioButton(_("Female"), "sex", false); - placer(1, row, mMaleButton); - placer(2, row, mFemaleButton); + if (serverVersion >= 5) + { + mOtherButton = new RadioButton(_("Other"), "sex", false); + placer(0, row, mMaleButton); + placer(1, row, mFemaleButton); + placer(2, row, mOtherButton); + } + else + { + placer(1, row, mMaleButton); + placer(2, row, mFemaleButton); + } row++; } @@ -235,9 +246,13 @@ void RegisterDialog::action(const gcn::ActionEvent &event) mLoginData->username = mUserField->getText(); mLoginData->password = mPasswordField->getText(); - if (mFemaleButton) - mLoginData->gender = mFemaleButton->isSelected() ? - GENDER_FEMALE : GENDER_MALE; + if (mFemaleButton && mFemaleButton->isSelected()) + mLoginData->gender = GENDER_FEMALE; + else if (mOtherButton && mOtherButton->isSelected()) + mLoginData->gender = GENDER_OTHER; + else + mLoginData->gender = GENDER_MALE; + if (mEmailField) mLoginData->email = mEmailField->getText(); mLoginData->registerLogin = true; diff --git a/src/gui/register.h b/src/gui/register.h index ecda27d28..606050428 100644 --- a/src/gui/register.h +++ b/src/gui/register.h @@ -96,6 +96,7 @@ class RegisterDialog : public Window, public gcn::ActionListener, gcn::Button *mCancelButton; gcn::RadioButton *mMaleButton; gcn::RadioButton *mFemaleButton; + gcn::RadioButton *mOtherButton; WrongDataNoticeListener *mWrongDataNoticeListener; |