From ef4486580fc7b8293555fcabc398ed0c2b90d78e Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sat, 26 Aug 2006 16:01:24 +0000 Subject: Got rid of numerous additions and substractions to the hair style and color. Hair style 0 was added and defined as being bald (so bald is no longer a hardcoded style). --- src/gui/char_select.cpp | 11 +++++------ src/gui/playerbox.cpp | 5 +++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/gui') diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 2fa6c68e..3db82287 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -183,8 +183,8 @@ void CharSelectDialog::updatePlayerInfo() mDelCharButton->setEnabled(true); mSelectButton->setEnabled(true); } - mPlayerBox->mHairStyle = pi->getHairStyle() - 1; - mPlayerBox->mHairColor = pi->getHairColor() - 1; + mPlayerBox->mHairStyle = pi->getHairStyle(); + mPlayerBox->mHairColor = pi->getHairColor(); mPlayerBox->mSex = pi->getSex(); mPlayerBox->mShowPlayer = true; } else { @@ -324,11 +324,10 @@ std::string CharCreateDialog::getName() void CharCreateDialog::attemptCharCreate() { // Send character infos - MessageOut outMsg; - outMsg.writeShort(PAMSG_CHAR_CREATE); + MessageOut outMsg(PAMSG_CHAR_CREATE); outMsg.writeString(getName()); - outMsg.writeByte(mPlayerBox->mHairStyle + 1); - outMsg.writeByte(mPlayerBox->mHairColor + 1); + outMsg.writeByte(mPlayerBox->mHairStyle); + outMsg.writeByte(mPlayerBox->mHairColor); // TODO: send selected sex outMsg.writeByte(0); // Player sex outMsg.writeShort(10); // STR diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index d8faff99..ba97d54c 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -94,12 +94,13 @@ void PlayerBox::draw(gcn::Graphics *graphics) playerset[mSex]->get(0), 23, 12); // Draw his hair - if (mHairColor < NR_HAIR_COLORS && mHairStyle < NR_HAIR_STYLES) + if (mHairStyle > 0 && mHairColor < NR_HAIR_COLORS && + mHairStyle < NR_HAIR_STYLES) { int hf = 9 * mHairColor; if (hf >= 0 && hf < (int)hairset[mHairStyle]->size()) { dynamic_cast(graphics)->drawImage( - hairset[mHairStyle]->get(hf), 35, 7); + hairset[mHairStyle - 1]->get(hf), 35, 7); } } } -- cgit v1.2.3-70-g09d2