From a3f8e297c74534ceba6063e10cdeee558b215d6d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 30 May 2013 00:50:00 +0300 Subject: Limit hair color and hair style only for one byte. Other bytes reserved for future usage. --- src/net/ea/beinghandler.cpp | 6 ++++-- src/net/tmwa/beinghandler.cpp | 6 ++++-- src/net/tmwa/charserverhandler.cpp | 12 ++++++++---- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 71194520d..05b7c348a 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -200,7 +200,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, if (dstBeing->getType() == ActorSprite::MONSTER && player_node) player_node->checkNewName(dstBeing); - const int hairStyle = msg.readInt16(); + const int hairStyle = msg.readInt8(); + msg.readInt8(); // free const uint16_t weapon = msg.readInt16(); const uint16_t headBottom = msg.readInt16(); @@ -210,7 +211,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg, const uint16_t shield = msg.readInt16(); const uint16_t headTop = msg.readInt16(); const uint16_t headMid = msg.readInt16(); - const int hairColor = msg.readInt16(); + const int hairColor = msg.readInt8(); + msg.readInt8(); // free const uint16_t shoes = msg.readInt16(); // clothes color uint16_t gloves; diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 3ef060d96..738a81651 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -477,7 +477,8 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, dstBeing->setWalkSpeed(Vector(speed, speed, 0)); dstBeing->setSubtype(job); - const int hairStyle = msg.readInt16(); + const int hairStyle = msg.readInt8(); + msg.readInt8(); // free const uint16_t weapon = msg.readInt16(); const uint16_t shield = msg.readInt16(); const uint16_t headBottom = msg.readInt16(); @@ -487,7 +488,8 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, const uint16_t headTop = msg.readInt16(); const uint16_t headMid = msg.readInt16(); - const int hairColor = msg.readInt16(); + const int hairColor = msg.readInt8(); + msg.readInt8(); // free unsigned char colors[9]; colors[0] = msg.readInt8(); diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 773a9d060..10be5edf8 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -159,7 +159,8 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, msg.readInt16(); // speed tempPlayer->setSubtype(msg.readInt16()); // class (used for race) - const int hairStyle = msg.readInt16(); + const int hairStyle = msg.readInt8(); + msg.readInt8(); // free const uint16_t weapon = msg.readInt16(); // unused on server. need use? tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true); @@ -172,9 +173,10 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, const int hat = msg.readInt16(); // head option top const int topClothes = msg.readInt16(); - int hairColor = msg.readInt16(); + int hairColor = msg.readInt8(); if (hairColor > 255) hairColor = 255; + msg.readInt8(); // free tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1, ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); tempPlayer->setHairColor(static_cast(hairColor)); @@ -253,8 +255,10 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot, outMsg.writeInt8(static_cast(stats[i])); outMsg.writeInt8(static_cast(slot)); - outMsg.writeInt16(static_cast(hairColor)); - outMsg.writeInt16(static_cast(hairstyle)); + outMsg.writeInt8(static_cast(hairColor)); + outMsg.writeInt8(0); // unused + outMsg.writeInt8(static_cast(hairstyle)); + outMsg.writeInt8(0); // unused if (serverVersion >= 2) outMsg.writeInt8(race); } -- cgit v1.2.3-70-g09d2