From 95100fc5191ea6e2e379ca73cd4e67bee4376ba1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 11 Jun 2013 23:40:50 +0300 Subject: add support for player look. --- src/gui/charcreatedialog.cpp | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/gui/charcreatedialog.cpp') diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp index f9dd1e675..c32098b63 100644 --- a/src/gui/charcreatedialog.cpp +++ b/src/gui/charcreatedialog.cpp @@ -174,7 +174,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mRaceLabel = new Label(this, _("Race:")); mRaceNameLabel = new Label(this, ""); } - if (mMinLook < mMaxLook) + if (serverVersion >= 9 && mMinLook < mMaxLook) { // TRANSLATORS: char create dialog button mNextLookButton = new Button(this, _(">"), "nextlook", this); @@ -230,7 +230,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mHairStyleLabel->setPosition(labelX, y); mHairStyleNameLabel->setPosition(nameX, y); - if (mMinLook < mMaxLook) + if (serverVersion >= 9 && mMinLook < mMaxLook) { y += 24; mPrevLookButton->setPosition(leftX, y); @@ -270,7 +270,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, add(mActionButton); add(mRotateButton); - if (mMinLook < mMaxLook) + if (serverVersion >= 9 && mMinLook < mMaxLook) { add(mNextLookButton); add(mPrevLookButton); @@ -301,7 +301,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, updateHair(); if (serverVersion >= 2) updateRace(); - if (mMinLook < mMaxLook) + if (serverVersion >= 9 && mMinLook < mMaxLook) updateLook(); updatePlayer(); @@ -349,7 +349,7 @@ void CharCreateDialog::action(const gcn::ActionEvent &event) Net::getCharServerHandler()->newCharacter(getName(), characterSlot, mFemale->isSelected(), mHairStyle, mHairColor, - static_cast(mRace), atts); + static_cast(mRace), mLook, atts); } else { @@ -613,32 +613,37 @@ void CharCreateDialog::updateRace() else if (mRace >= Being::getNumOfRaces()) mRace = 0; - mPlayer->setSubtype(static_cast(mRace), mLook); - const ItemInfo &item = ItemDB::get(-100 - mRace); - mRaceNameLabel->setCaption(item.getName()); - mRaceNameLabel->adjustSize(); + updateLook(); } void CharCreateDialog::updateLook() { const ItemInfo &item = ItemDB::get(-100 - mRace); const int sz = item.getColorsSize(); - if (sz > 0) + if (sz > 0 && serverVersion >= 9) { if (mLook < 0) mLook = sz - 1; if (mLook > mMaxLook) - mLook = mMaxLook; + mLook = mMinLook; if (mLook >= sz) - mLook = 0; + mLook = mMinLook; } else { mLook = 0; } mPlayer->setSubtype(static_cast(mRace), mLook); - mLookNameLabel->setCaption(item.getColorName(mLook)); - mLookNameLabel->adjustSize(); + if (mRaceNameLabel) + { + mRaceNameLabel->setCaption(item.getName()); + mRaceNameLabel->adjustSize(); + } + if (mLookNameLabel) + { + mLookNameLabel->setCaption(item.getColorName(mLook)); + mLookNameLabel->adjustSize(); + } } void CharCreateDialog::logic() -- cgit v1.2.3-70-g09d2