From dd1a1121308c52269894073ec3326ebfc8c6aa0b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Jan 2016 23:39:43 +0300 Subject: In char create dialog allow hair style with wrong range. --- src/gui/windows/charcreatedialog.cpp | 57 +++++++++++++++++++++++------------- 1 file changed, 37 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index e39552ed8..6e8120373 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -84,13 +84,10 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mPrevHairColorButton(nullptr), mHairColorLabel(nullptr), mHairColorNameLabel(nullptr), - // TRANSLATORS: char create dialog button - mNextHairStyleButton(new Button(this, _(">"), "nextstyle", this)), - // TRANSLATORS: char create dialog button - mPrevHairStyleButton(new Button(this, _("<"), "prevstyle", this)), - // TRANSLATORS: char create dialog label - mHairStyleLabel(new Label(this, _("Hair style:"))), - mHairStyleNameLabel(new Label(this, "")), + mNextHairStyleButton(nullptr), + mPrevHairStyleButton(nullptr), + mHairStyleLabel(nullptr), + mHairStyleNameLabel(nullptr), mNextRaceButton(nullptr), mPrevRaceButton(nullptr), mRaceLabel(nullptr), @@ -200,6 +197,17 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mHairColorNameLabel = new Label(this, ""); } + if (maxHairStyle > minHairStyle) + { + // TRANSLATORS: char create dialog button + mNextHairStyleButton = new Button(this, _(">"), "nextstyle", this); + // TRANSLATORS: char create dialog button + mPrevHairStyleButton = new Button(this, _("<"), "prevstyle", this); + // TRANSLATORS: char create dialog label + mHairStyleLabel = new Label(this, _("Hair style:")); + mHairStyleNameLabel = new Label(this, ""); + } + if (serverFeatures->haveRaceSelection() && mMinRace < mMaxRace) { // TRANSLATORS: char create dialog button @@ -315,15 +323,18 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mHairColorNameLabel->setPosition(nameX, y); y += 24; } - mPrevHairStyleButton->setPosition(leftX, y); - mNextHairStyleButton->setPosition(rightX, y); - y += 5; - mHairStyleLabel->setPosition(labelX, y); - mHairStyleNameLabel->setPosition(nameX, y); + if (maxHairStyle > minHairStyle) + { + mPrevHairStyleButton->setPosition(leftX, y); + mNextHairStyleButton->setPosition(rightX, y); + y += 5; + mHairStyleLabel->setPosition(labelX, y); + mHairStyleNameLabel->setPosition(nameX, y); + y += 24; + } if (serverFeatures->haveLookSelection() && mMinLook < mMaxLook) { - y += 24; if (mPrevLookButton) mPrevLookButton->setPosition(leftX, y); if (mNextLookButton) @@ -333,10 +344,10 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mLookLabel->setPosition(labelX, y); if (mLookNameLabel) mLookNameLabel->setPosition(nameX, y); // 93 + y += 24; } if (serverFeatures->haveRaceSelection() && mMinRace < mMaxRace) { - y += 24; if (mPrevRaceButton) mPrevRaceButton->setPosition(leftX, y); if (mNextRaceButton) @@ -364,10 +375,13 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, add(mHairColorNameLabel); } - add(mNextHairStyleButton); - add(mPrevHairStyleButton); - add(mHairStyleLabel); - add(mHairStyleNameLabel); + if (maxHairStyle > minHairStyle) + { + add(mNextHairStyleButton); + add(mPrevHairStyleButton); + add(mHairStyleLabel); + add(mHairStyleNameLabel); + } add(mActionButton); add(mRotateButton); @@ -696,8 +710,11 @@ void CharCreateDialog::updateHair() mHairStyle = minHairStyle; } const ItemInfo &item = ItemDB::get(-mHairStyle); - mHairStyleNameLabel->setCaption(item.getName()); - mHairStyleNameLabel->resizeTo(150, 150); + if (mHairStyleNameLabel) + { + mHairStyleNameLabel->setCaption(item.getName()); + mHairStyleNameLabel->resizeTo(150, 150); + } if (ColorDB::getHairSize()) mHairColor %= ColorDB::getHairSize(); -- cgit v1.2.3-70-g09d2