diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-10 17:44:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-10 17:44:28 +0300 |
commit | 7f9e82c6538dd51992518ee2af23d98a7c39cdeb (patch) | |
tree | 2070133e86d349b3579cd862d4bdee01554c1ed1 /src | |
parent | 5a15b718a475f8c2809521ea3166de379bf85b36 (diff) | |
download | mv-7f9e82c6538dd51992518ee2af23d98a7c39cdeb.tar.gz mv-7f9e82c6538dd51992518ee2af23d98a7c39cdeb.tar.bz2 mv-7f9e82c6538dd51992518ee2af23d98a7c39cdeb.tar.xz mv-7f9e82c6538dd51992518ee2af23d98a7c39cdeb.zip |
Allow hide player stats sliders in char creation dialog.
It hidden if configuration parameters is wrong.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/charcreatedialog.cpp | 40 | ||||
-rw-r--r-- | src/gui/windows/charcreatedialog.h | 2 |
2 files changed, 30 insertions, 12 deletions
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 0f693aa45..57d956ca5 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -615,9 +615,21 @@ int CharCreateDialog::getDistributedPoints() const } void CharCreateDialog::setAttributes(const StringVect &labels, - const int available, + int available, const int min, const int max) { + size_t sz; + + if (min == max || available == 0) + { + sz = 0U; + available = 0; + } + else + { + sz = labels.size(); + } + mMaxPoints = available; for (size_t i = 0; i < mAttributeLabel.size(); i++) @@ -630,20 +642,19 @@ void CharCreateDialog::setAttributes(const StringVect &labels, delete2(mAttributeValue[i]) } - mAttributeLabel.resize(labels.size()); - mAttributeSlider.resize(labels.size()); - mAttributeValue.resize(labels.size()); + mAttributeLabel.resize(sz); + mAttributeSlider.resize(sz); + mAttributeValue.resize(sz); - const int w = 480; - int h = 350; - int y = 89; + const uint32_t w = 480; + uint32_t h = 350; + uint32_t y = 89; if (serverFeatures->haveLookSelection() && mMinLook < mMaxLook) y += 29; if (serverFeatures->haveRaceSelection() && mMinRace < mMaxRace) y += 29; - for (unsigned i = 0, sz = CAST_U32(labels.size()); - i < sz; i++) + for (size_t i = 0; i < sz; i++) { mAttributeLabel[i] = new Label(this, labels[i]); mAttributeLabel[i]->setWidth(70); @@ -671,8 +682,7 @@ void CharCreateDialog::setAttributes(const StringVect &labels, } else { - h = y + labels.size() * 24 + - mAttributesLeft->getHeight() + getPadding(); + h = y + sz * 24 + mAttributesLeft->getHeight() + getPadding(); } if (serverFeatures->haveCreateCharGender() && features.getIntValue("forceCharGender") == -1 && @@ -683,6 +693,14 @@ void CharCreateDialog::setAttributes(const StringVect &labels, } if (h < mMaxY) h = mMaxY; + if (serverFeatures->haveCreateCharGender()) + { + const int forceGender = features.getIntValue("forceCharGender"); + if (forceGender == -1 && h < 180) + h = 180; + else if (h < 120) + h = 120; + } h += mCreateButton->getHeight(); setContentSize(w, h); diff --git a/src/gui/windows/charcreatedialog.h b/src/gui/windows/charcreatedialog.h index 634e78c2c..e41b17157 100644 --- a/src/gui/windows/charcreatedialog.h +++ b/src/gui/windows/charcreatedialog.h @@ -69,7 +69,7 @@ class CharCreateDialog final : public Window, void unlock(); void setAttributes(const StringVect &labels, - const int available, + int available, const int min, const int max); void setDefaultGender(const GenderT gender = Gender::FEMALE); |