summaryrefslogtreecommitdiff
path: root/src/net/tmwa/charserverhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-30 00:50:00 +0300
committerAndrei Karas <akaras@inbox.ru>2013-05-30 00:50:00 +0300
commita3f8e297c74534ceba6063e10cdeee558b215d6d (patch)
tree919c4cc0a7bd78fb4d6c8dda03a35e13f3b67532 /src/net/tmwa/charserverhandler.cpp
parent82f54003e520947340823e8d86dcb8c57e182237 (diff)
downloadplus-a3f8e297c74534ceba6063e10cdeee558b215d6d.tar.gz
plus-a3f8e297c74534ceba6063e10cdeee558b215d6d.tar.bz2
plus-a3f8e297c74534ceba6063e10cdeee558b215d6d.tar.xz
plus-a3f8e297c74534ceba6063e10cdeee558b215d6d.zip
Limit hair color and hair style only for one byte.
Other bytes reserved for future usage.
Diffstat (limited to 'src/net/tmwa/charserverhandler.cpp')
-rw-r--r--src/net/tmwa/charserverhandler.cpp12
1 files changed, 8 insertions, 4 deletions
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<unsigned char>(hairColor));
@@ -253,8 +255,10 @@ void CharServerHandler::newCharacter(const std::string &name, const int slot,
outMsg.writeInt8(static_cast<unsigned char>(stats[i]));
outMsg.writeInt8(static_cast<unsigned char>(slot));
- outMsg.writeInt16(static_cast<int16_t>(hairColor));
- outMsg.writeInt16(static_cast<int16_t>(hairstyle));
+ outMsg.writeInt8(static_cast<int8_t>(hairColor));
+ outMsg.writeInt8(0); // unused
+ outMsg.writeInt8(static_cast<int8_t>(hairstyle));
+ outMsg.writeInt8(0); // unused
if (serverVersion >= 2)
outMsg.writeInt8(race);
}