summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-27 23:39:43 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-27 23:39:43 +0300
commitdd1a1121308c52269894073ec3326ebfc8c6aa0b (patch)
treeeea8ebfb3aa0433f8292db38fb18a616b15beeaa /src/gui
parent29407b5b7b650f558808ede2bbe758b3376c2cf0 (diff)
downloadmanaplus-dd1a1121308c52269894073ec3326ebfc8c6aa0b.tar.gz
manaplus-dd1a1121308c52269894073ec3326ebfc8c6aa0b.tar.bz2
manaplus-dd1a1121308c52269894073ec3326ebfc8c6aa0b.tar.xz
manaplus-dd1a1121308c52269894073ec3326ebfc8c6aa0b.zip
In char create dialog allow hair style with wrong range.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/charcreatedialog.cpp57
1 files changed, 37 insertions, 20 deletions
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();