summaryrefslogtreecommitdiff
path: root/src/net/tmwserv
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-08-13 17:30:59 -0600
committerJared Adams <jaxad0127@gmail.com>2009-08-13 17:33:08 -0600
commitf46cfb91278b27f4943f5512778129fe985c678e (patch)
tree0be219d66e723bcca8de2d584d66bc65d040fb26 /src/net/tmwserv
parentbe85ca9d91ff867faf140328d0bcbb2062b58cdf (diff)
downloadmana-f46cfb91278b27f4943f5512778129fe985c678e.tar.gz
mana-f46cfb91278b27f4943f5512778129fe985c678e.tar.bz2
mana-f46cfb91278b27f4943f5512778129fe985c678e.tar.xz
mana-f46cfb91278b27f4943f5512778129fe985c678e.zip
Clean up Being and it's derivatives
Move stuff only needed for Players into Player (like slots and sprite limits). Move name handling into Being (no need for three copies of this code). Clean up terminology (including Map terminology). Remove hair-related variables.
Diffstat (limited to 'src/net/tmwserv')
-rw-r--r--src/net/tmwserv/beinghandler.cpp11
-rw-r--r--src/net/tmwserv/charserverhandler.cpp4
2 files changed, 9 insertions, 6 deletions
diff --git a/src/net/tmwserv/beinghandler.cpp b/src/net/tmwserv/beinghandler.cpp
index acd6b62c..d5092782 100644
--- a/src/net/tmwserv/beinghandler.cpp
+++ b/src/net/tmwserv/beinghandler.cpp
@@ -37,6 +37,8 @@
#include "gui/okdialog.h"
+#include "resources/colordb.h"
+
#include "utils/gettext.h"
#include "net/tmwserv/gameserver/player.h"
@@ -95,8 +97,8 @@ static void handleLooks(Player *being, MessageIn &msg)
// Order of sent slots. Has to be in sync with the server code.
static int const nb_slots = 4;
static int const slots[nb_slots] =
- { Being::WEAPON_SPRITE, Being::HAT_SPRITE, Being::TOPCLOTHES_SPRITE,
- Being::BOTTOMCLOTHES_SPRITE };
+ { Player::WEAPON_SPRITE, Player::HAT_SPRITE, Player::TOPCLOTHES_SPRITE,
+ Player::BOTTOMCLOTHES_SPRITE };
int mask = msg.readInt8();
@@ -144,7 +146,7 @@ void BeingHandler::handleBeingEnterMessage(MessageIn &msg)
}
Player *p = static_cast< Player * >(being);
int hs = msg.readInt8(), hc = msg.readInt8();
- p->setHairStyle(hs, hc);
+ p->setSprite(Player::HAIR_SPRITE, hs * -1, ColorDB::get(hc));
p->setGender(msg.readInt8() == GENDER_MALE ?
GENDER_MALE : GENDER_FEMALE);
handleLooks(p, msg);
@@ -304,8 +306,7 @@ void BeingHandler::handleBeingLooksChangeMessage(MessageIn &msg)
{
int style = msg.readInt16();
int color = msg.readInt16();
- player->setHairStyle(style, color);
- player->setGender((Gender)msg.readInt16());
+ player->setSprite(Player::HAIR_SPRITE, style * -1, ColorDB::get(color));
}
}
diff --git a/src/net/tmwserv/charserverhandler.cpp b/src/net/tmwserv/charserverhandler.cpp
index 0146babb..93181a93 100644
--- a/src/net/tmwserv/charserverhandler.cpp
+++ b/src/net/tmwserv/charserverhandler.cpp
@@ -38,6 +38,8 @@
#include "gui/charcreatedialog.h"
#include "gui/okdialog.h"
+#include "resources/colordb.h"
+
#include "utils/gettext.h"
extern Net::Connection *gameServerConnection;
@@ -229,7 +231,7 @@ LocalPlayer* CharServerHandler::readPlayerData(MessageIn &msg, int &slot)
tempPlayer->setName(msg.readString());
tempPlayer->setGender(msg.readInt8() == GENDER_MALE ? GENDER_MALE : GENDER_FEMALE);
int hs = msg.readInt8(), hc = msg.readInt8();
- tempPlayer->setHairStyle(hs, hc);
+ tempPlayer->setSprite(Player::HAIR_SPRITE, hs * -1, ColorDB::get(hc));
tempPlayer->setLevel(msg.readInt16());
tempPlayer->setCharacterPoints(msg.readInt16());
tempPlayer->setCorrectionPoints(msg.readInt16());