diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-02 21:38:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-02 21:40:43 +0300 |
commit | 4cffca0da71771d0d51ba4cd4842d2d93aa2946e (patch) | |
tree | 99b974a5bab64174ebd29ef7a4761caef01acec8 /src/net/tmwa/charserverhandler.cpp | |
parent | 1dab21b236d76900f3ddd2be32f9590aef394c2d (diff) | |
download | manaplus-4cffca0da71771d0d51ba4cd4842d2d93aa2946e.tar.gz manaplus-4cffca0da71771d0d51ba4cd4842d2d93aa2946e.tar.bz2 manaplus-4cffca0da71771d0d51ba4cd4842d2d93aa2946e.tar.xz manaplus-4cffca0da71771d0d51ba4cd4842d2d93aa2946e.zip |
Fix some conversions.
Diffstat (limited to 'src/net/tmwa/charserverhandler.cpp')
-rw-r--r-- | src/net/tmwa/charserverhandler.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 4e3763042..e8c9dfaff 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -217,10 +217,12 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, const int hat = msg.readInt16(); // head option top const int topClothes = msg.readInt16(); - const int hairColor = msg.readInt16(); + int hairColor = msg.readInt16(); + if (hairColor > 255) + hairColor = 255; tempPlayer->setSprite(SPRITE_HAIR, hairStyle * -1, ItemDB::get(-hairStyle).getDyeColorsString(hairColor)); - tempPlayer->setHairColor(hairColor); + tempPlayer->setHairColor(static_cast<unsigned char>(hairColor)); const int misc2 = msg.readInt16(); tempPlayer->setName(msg.readString(24)); |