From 8a60e11684e84807f3526b37afa8cbf6f103b8fd Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sat, 3 Nov 2007 09:58:25 +0000 Subject: Fixed double load of hair graphics. --- src/gui/char_select.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/gui') diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index c2306880..ccdf20c8 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -245,8 +245,7 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot): Window(_("Create Character"), true, parent), mSlot(slot) { mPlayer = new Player(0, 0, NULL); - mPlayer->setHairStyle(rand() % NR_HAIR_STYLES); - mPlayer->setHairColor(rand() % NR_HAIR_COLORS); + mPlayer->setHairStyle(rand() % NR_HAIR_STYLES, rand() % NR_HAIR_COLORS); mNameField = new TextField(""); mNameLabel = new gcn::Label(_("Name:")); @@ -373,18 +372,16 @@ CharCreateDialog::action(const gcn::ActionEvent &event) scheduleDelete(); } else if (event.getId() == "nextcolor") { - mPlayer->setHairColor((mPlayer->getHairColor() + 1) % NR_HAIR_COLORS); + mPlayer->setHairStyle(-1, mPlayer->getHairColor() + 1); } else if (event.getId() == "prevcolor") { - int prevColor = mPlayer->getHairColor() + NR_HAIR_COLORS - 1; - mPlayer->setHairColor(prevColor % NR_HAIR_COLORS); + mPlayer->setHairStyle(-1, mPlayer->getHairColor() + NR_HAIR_COLORS - 1); } else if (event.getId() == "nextstyle") { - mPlayer->setHairStyle((mPlayer->getHairStyle() + 1) % NR_HAIR_STYLES); + mPlayer->setHairStyle(mPlayer->getHairStyle() + 1, -1); } else if (event.getId() == "prevstyle") { - int prevStyle = mPlayer->getHairStyle() + NR_HAIR_STYLES - 1; - mPlayer->setHairStyle(prevStyle % NR_HAIR_STYLES); + mPlayer->setHairStyle(mPlayer->getHairStyle() + NR_HAIR_STYLES - 1, -1); } else if (event.getId() == "statslider") { UpdateSliders(); -- cgit v1.2.3-70-g09d2