summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-10 23:42:55 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-01-10 23:42:55 +0000
commit9c8e872f2cb8c8dd919eff61a4ce9d63b041f715 (patch)
treee2461fd6df6499ea1d7a1ec5f1d92179a77652ab /src
parent3fe5d486bf33d4658ab75b49fe878a9a0394d835 (diff)
downloadmana-9c8e872f2cb8c8dd919eff61a4ce9d63b041f715.tar.gz
mana-9c8e872f2cb8c8dd919eff61a4ce9d63b041f715.tar.bz2
mana-9c8e872f2cb8c8dd919eff61a4ce9d63b041f715.tar.xz
mana-9c8e872f2cb8c8dd919eff61a4ce9d63b041f715.zip
Accepted bugfixes for character creation from Rogier Polak.
Diffstat (limited to 'src')
-rw-r--r--src/gui/char_select.cpp16
-rw-r--r--src/net/accountserver/account.cpp2
-rw-r--r--src/net/accountserver/account.h2
-rw-r--r--src/player.cpp12
4 files changed, 16 insertions, 16 deletions
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 3cb42078..ec4dad2e 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -238,8 +238,8 @@ 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 + 1);
- mPlayer->setHairColor(rand() % NR_HAIR_COLORS + 1);
+ mPlayer->setHairStyle(rand() % NR_HAIR_STYLES);
+ mPlayer->setHairColor(rand() % NR_HAIR_COLORS);
mNameField = new TextField("");
mNameLabel = new gcn::Label("Name:");
@@ -326,18 +326,18 @@ void CharCreateDialog::action(const std::string &eventId, gcn::Widget *widget)
scheduleDelete();
}
else if (eventId == "nextcolor") {
- mPlayer->setHairColor(mPlayer->getHairColor() % NR_HAIR_COLORS + 1);
+ mPlayer->setHairColor((mPlayer->getHairColor() + 1) % NR_HAIR_COLORS);
}
else if (eventId == "prevcolor") {
- int prevColor = mPlayer->getHairColor() + NR_HAIR_COLORS - 2;
- mPlayer->setHairColor(prevColor % NR_HAIR_COLORS + 1);
+ int prevColor = mPlayer->getHairColor() + NR_HAIR_COLORS - 1;
+ mPlayer->setHairColor(prevColor % NR_HAIR_COLORS);
}
else if (eventId == "nextstyle") {
- mPlayer->setHairStyle(mPlayer->getHairStyle() % NR_HAIR_STYLES + 1);
+ mPlayer->setHairStyle((mPlayer->getHairStyle() + 1) % NR_HAIR_STYLES);
}
else if (eventId == "prevstyle") {
- int prevStyle = mPlayer->getHairStyle() + NR_HAIR_STYLES - 2;
- mPlayer->setHairStyle(prevStyle % NR_HAIR_STYLES + 1);
+ int prevStyle = mPlayer->getHairStyle() + NR_HAIR_STYLES - 1;
+ mPlayer->setHairStyle(prevStyle % NR_HAIR_STYLES);
}
}
diff --git a/src/net/accountserver/account.cpp b/src/net/accountserver/account.cpp
index 7275cacc..daf94a65 100644
--- a/src/net/accountserver/account.cpp
+++ b/src/net/accountserver/account.cpp
@@ -30,7 +30,7 @@
#include "../protocol.h"
void Net::AccountServer::Account::createCharacter(
- const std::string &name, char hairColor, char hairStyle, char gender,
+ const std::string &name, char hairStyle, char hairColor, char gender,
short strength, short agility, short vitality,
short intelligence, short dexterity, short luck)
{
diff --git a/src/net/accountserver/account.h b/src/net/accountserver/account.h
index 368623e6..aaf3afe0 100644
--- a/src/net/accountserver/account.h
+++ b/src/net/accountserver/account.h
@@ -33,7 +33,7 @@ namespace Net
namespace Account
{
void createCharacter(const std::string &name,
- char hairColor, char hairStyle, char gender,
+ char hairStyle, char hairColor, char gender,
short strength, short agility, short vitality,
short intelligence, short dexterity, short luck);
diff --git a/src/player.cpp b/src/player.cpp
index 63ed5455..288401e4 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -140,9 +140,11 @@ Player::setHairColor(Uint16 color)
{
if (color != mHairColor)
{
+ Being::setHairColor(color);
+
AnimatedSprite *newHairSprite = new AnimatedSprite(
"graphics/sprites/hairstyle" + toString(mHairStyle) + ".xml",
- color);
+ mHairColor);
newHairSprite->setDirection(getSpriteDirection());
delete mSprites[HAIR_SPRITE];
@@ -150,8 +152,6 @@ Player::setHairColor(Uint16 color)
setAction(mAction);
}
-
- Being::setHairColor(color);
}
void
@@ -159,8 +159,10 @@ Player::setHairStyle(Uint16 style)
{
if (style != mHairStyle)
{
+ Being::setHairStyle(style);
+
AnimatedSprite *newHairSprite = new AnimatedSprite(
- "graphics/sprites/hairstyle" + toString(style) + ".xml",
+ "graphics/sprites/hairstyle" + toString(mHairStyle) + ".xml",
mHairColor);
newHairSprite->setDirection(getSpriteDirection());
@@ -169,8 +171,6 @@ Player::setHairStyle(Uint16 style)
setAction(mAction);
}
-
- Being::setHairStyle(style);
}
void