From f46cfb91278b27f4943f5512778129fe985c678e Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Thu, 13 Aug 2009 17:30:59 -0600 Subject: 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. --- src/net/tmwserv/beinghandler.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/net/tmwserv/beinghandler.cpp') 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)); } } -- cgit v1.2.3-70-g09d2