diff options
author | Ira Rice <irarice@gmail.com> | 2008-10-15 15:23:21 +0000 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-10-15 15:23:21 +0000 |
commit | d3f84af9d22814db0ec67e87805b3d1054afd606 (patch) | |
tree | 9ee8fa2f0cb9b85da65bfebd0f2f74cbf8fbf20e /src/gui/char_select.cpp | |
parent | 0ce8857e4e3fbd69c48f7db9123293bdcbcd9751 (diff) | |
download | mana-d3f84af9d22814db0ec67e87805b3d1054afd606.tar.gz mana-d3f84af9d22814db0ec67e87805b3d1054afd606.tar.bz2 mana-d3f84af9d22814db0ec67e87805b3d1054afd606.tar.xz mana-d3f84af9d22814db0ec67e87805b3d1054afd606.zip |
De-hardcoded colors in trunk. Now, all colors are loaded from
colors.xml.
Diffstat (limited to 'src/gui/char_select.cpp')
-rw-r--r-- | src/gui/char_select.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index c4b1d89e..65d0159f 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -256,7 +256,10 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network, { mPlayer = new Player(0, 0, NULL); mPlayer->setGender(gender); - mPlayer->setHairStyle(rand() % NR_HAIR_STYLES, rand() % NR_HAIR_COLORS); + + int numberOfHairColors = ColorDB::size(); + + mPlayer->setHairStyle(rand() % NR_HAIR_STYLES, rand() % numberOfHairColors); mNameField = new TextField(""); mNameLabel = new gcn::Label("Name:"); @@ -322,6 +325,7 @@ CharCreateDialog::~CharCreateDialog() void CharCreateDialog::action(const gcn::ActionEvent &event) { + int numberOfColors = ColorDB::size(); if (event.getId() == "create") { if (getName().length() >= 4) { // Attempt to create the character @@ -340,7 +344,7 @@ CharCreateDialog::action(const gcn::ActionEvent &event) mPlayer->setHairStyle(-1, mPlayer->getHairColor() + 1); } else if (event.getId() == "prevcolor") { - mPlayer->setHairStyle(-1, mPlayer->getHairColor() + NR_HAIR_COLORS - 1); + mPlayer->setHairStyle(-1, mPlayer->getHairColor() + numberOfColors - 1); } else if (event.getId() == "nextstyle") { mPlayer->setHairStyle(mPlayer->getHairStyle() + 1, -1); |