summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actormanager.cpp12
-rw-r--r--src/net/eathena/beingrecv.cpp48
-rw-r--r--src/net/eathena/charserverrecv.cpp13
-rw-r--r--src/net/tmwa/beingrecv.cpp74
-rw-r--r--src/net/tmwa/charserverrecv.cpp14
5 files changed, 138 insertions, 23 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 020d3a9f5..82be50ea8 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -2043,8 +2043,16 @@ Being *ActorManager::cloneBeing(const Being *const srcBeing,
const int hairSlot = charServerHandler->hairSprite();
const int hairStyle = -srcBeing->getSpriteID(hairSlot);
const ItemColor hairColor = srcBeing->getHairColor();
- dstBeing->setSprite(hairSlot, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle != 0)
+ {
+ dstBeing->setSprite(hairSlot,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
+ else
+ {
+ dstBeing->setSprite(hairSlot, 0, std::string());
+ }
dstBeing->setHairColor(hairColor);
return dstBeing;
}
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index 5c5e18ce8..5d4c59d00 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -380,8 +380,20 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
dstBeing->setGender(Being::intToGender(gender));
dstBeing->setHairColor(hairColor);
// Set these after the gender, as the sprites may be gender-specific
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle == 0)
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ 0,
+ std::string());
+ }
+ else
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
Ea::BeingRecv::setSprite(dstBeing, SPRITE_WEAPON, headBottom);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_HEAD_BOTTOM, headMid);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
@@ -568,8 +580,20 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg)
dstBeing->setGender(Being::intToGender(gender));
dstBeing->setHairColor(hairColor);
// Set these after the gender, as the sprites may be gender-specific
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle == 0)
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ 0,
+ std::string());
+ }
+ else
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
if (!serverFeatures->haveMove3())
{
Ea::BeingRecv::setSprite(dstBeing, SPRITE_WEAPON, headBottom);
@@ -758,8 +782,20 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg)
dstBeing->setGender(Being::intToGender(gender));
dstBeing->setHairColor(hairColor);
// Set these after the gender, as the sprites may be gender-specific
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle == 0)
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ 0,
+ std::string());
+ }
+ else
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
Ea::BeingRecv::setSprite(dstBeing, SPRITE_WEAPON, headBottom);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_HEAD_BOTTOM, headMid);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp
index a1417b9c8..fcf90acc9 100644
--- a/src/net/eathena/charserverrecv.cpp
+++ b/src/net/eathena/charserverrecv.cpp
@@ -141,9 +141,16 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg,
const ItemColor color = fromInt(msg.readInt16("hair color"), ItemColor);
tempPlayer->setHairColor(color);
- tempPlayer->setSprite(SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(
- color));
+ if (hairStyle == 0)
+ {
+ tempPlayer->setSprite(SPRITE_HAIR_COLOR, 0, std::string());
+ }
+ else
+ {
+ tempPlayer->setSprite(SPRITE_HAIR_COLOR, hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(
+ color));
+ }
const uint16_t look = msg.readInt16("clothes color");
tempPlayer->setSubtype(fromInt(race, BeingTypeId), look);
diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp
index 04c4a0444..cb5eefd92 100644
--- a/src/net/tmwa/beingrecv.cpp
+++ b/src/net/tmwa/beingrecv.cpp
@@ -316,8 +316,18 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg)
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
dstBeing->updateSprite(SPRITE_CLOTHES_COLOR, headTop);
- dstBeing->updateSprite(SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle == 0)
+ {
+ dstBeing->updateSprite(SPRITE_HAIR_COLOR,
+ 0,
+ std::string());
+ }
+ else
+ {
+ dstBeing->updateSprite(SPRITE_HAIR_COLOR,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
dstBeing->setHairColor(hairColor);
}
localPlayer->imitateOutfit(dstBeing);
@@ -448,8 +458,18 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg)
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
dstBeing->updateSprite(SPRITE_CLOTHES_COLOR, headTop);
- dstBeing->updateSprite(SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle == 0)
+ {
+ dstBeing->updateSprite(SPRITE_HAIR_COLOR,
+ 0,
+ std::string());
+ }
+ else
+ {
+ dstBeing->updateSprite(SPRITE_HAIR_COLOR,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
dstBeing->setHairColor(hairColor);
}
localPlayer->imitateOutfit(dstBeing);
@@ -580,8 +600,18 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg)
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
dstBeing->updateSprite(SPRITE_CLOTHES_COLOR, headTop);
- dstBeing->updateSprite(SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle == 0)
+ {
+ dstBeing->updateSprite(SPRITE_HAIR_COLOR,
+ 0,
+ std::string());
+ }
+ else
+ {
+ dstBeing->updateSprite(SPRITE_HAIR_COLOR,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
dstBeing->setHairColor(hairColor);
}
localPlayer->imitateOutfit(dstBeing);
@@ -794,8 +824,20 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
gender &= 3;
dstBeing->setGender(Being::intToGender(gender));
// Set these after the gender, as the sprites may be gender-specific
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle == 0)
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ 0,
+ std::string());
+ }
+ else
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
dstBeing->setHairColor(hairColor);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_WEAPON, headBottom);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_HEAD_BOTTOM, headMid);
@@ -995,8 +1037,20 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg)
gender &= 3;
dstBeing->setGender(Being::intToGender(gender));
// Set these after the gender, as the sprites may be gender-specific
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle == 0)
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ 0,
+ std::string());
+ }
+ else
+ {
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_HAIR_COLOR,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
dstBeing->setHairColor(hairColor);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_WEAPON, headBottom);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_HEAD_BOTTOM, headMid);
diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp
index 5032e4c39..428693678 100644
--- a/src/net/tmwa/charserverrecv.cpp
+++ b/src/net/tmwa/charserverrecv.cpp
@@ -118,8 +118,18 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg,
const ItemColor hairColor = fromInt(
msg.readUInt8("hair color"), ItemColor);
msg.readUInt8("unused");
- tempPlayer->setSprite(SPRITE_HAIR_COLOR, hairStyle * -1,
- ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ if (hairStyle == 0)
+ {
+ tempPlayer->setSprite(SPRITE_HAIR_COLOR,
+ 0,
+ std::string());
+ }
+ else
+ {
+ tempPlayer->setSprite(SPRITE_HAIR_COLOR,
+ hairStyle * -1,
+ ItemDB::get(-hairStyle).getDyeColorsString(hairColor));
+ }
tempPlayer->setHairColor(hairColor);
const int misc2 = msg.readInt16("misc2");