summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@googlemail.com>2013-03-09 10:55:24 +0100
committerErik Schilling <ablu.erikschilling@googlemail.com>2013-09-01 01:08:15 +0200
commit8ddda85d923a528c7497a628d2fe10fc40b80a1f (patch)
tree6b2d5d12f531e05a2cb05615be708ba13028ed03 /src
parent4fc1974292861485729ef72609311cb47632d47f (diff)
downloadmanaserv-8ddda85d923a528c7497a628d2fe10fc40b80a1f.tar.gz
manaserv-8ddda85d923a528c7497a628d2fe10fc40b80a1f.tar.bz2
manaserv-8ddda85d923a528c7497a628d2fe10fc40b80a1f.tar.xz
manaserv-8ddda85d923a528c7497a628d2fe10fc40b80a1f.zip
Fixed inconsistent type of hairstyle networking
Diffstat (limited to 'src')
-rw-r--r--src/common/manaserv_protocol.h6
-rw-r--r--src/game-server/state.cpp15
2 files changed, 8 insertions, 13 deletions
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h
index 73ea5932..50bfdd84 100644
--- a/src/common/manaserv_protocol.h
+++ b/src/common/manaserv_protocol.h
@@ -29,8 +29,8 @@
namespace ManaServ {
enum {
- PROTOCOL_VERSION = 5,
- SUPPORTED_DB_VERSION = 24
+ PROTOCOL_VERSION = 6,
+ SUPPORTED_DB_VERSION = 25
};
/**
@@ -130,7 +130,7 @@ enum {
// npc: W type id
GPMSG_BEING_LEAVE = 0x0201, // W being id
GPMSG_ITEM_APPEAR = 0x0202, // W item id, W*2 position
- GPMSG_BEING_LOOKS_CHANGE = 0x0210, // B sprite layers changed, { B slot type, W item id }*
+ GPMSG_BEING_LOOKS_CHANGE = 0x0210, // B hairstyle, B haircolor, B sprite layers changed, { B slot type, W item id }*
GPMSG_BEING_EMOTE = 0x0211, // W being id, W emote id
PGMSG_BEING_EMOTE = 0x0212, // W emoticon id
PGMSG_WALK = 0x0260, // W*2 destination
diff --git a/src/game-server/state.cpp b/src/game-server/state.cpp
index 3bed559f..a7cac98c 100644
--- a/src/game-server/state.cpp
+++ b/src/game-server/state.cpp
@@ -80,8 +80,11 @@ static std::map< std::string, std::string > mScriptVariables;
*/
static void serializeLooks(Entity *ch, MessageOut &msg)
{
- const EquipData &equipData = ch->getComponent<CharacterComponent>()
- ->getPossessions().getEquipment();
+ auto *characterComponent = ch->getComponent<CharacterComponent>();
+ msg.writeInt8(characterComponent->getHairStyle());
+ msg.writeInt8(characterComponent->getHairColor());
+ const EquipData &equipData =
+ characterComponent->getPossessions().getEquipment();
// We'll use a set to check whether we already sent the update for the given
// item instance.
@@ -180,12 +183,6 @@ static void informPlayer(MapComposite *map, Entity *p)
MessageOut LooksMsg(GPMSG_BEING_LOOKS_CHANGE);
LooksMsg.writeInt16(oid);
serializeLooks(o, LooksMsg);
- auto *characterComponent =
- o->getComponent<CharacterComponent>();
- LooksMsg.writeInt16(characterComponent->getHairStyle());
- LooksMsg.writeInt16(characterComponent->getHairColor());
- LooksMsg.writeInt16(
- o->getComponent<BeingComponent>()->getGender());
gameHandler->sendTo(p, LooksMsg);
}
@@ -286,8 +283,6 @@ static void informPlayer(MapComposite *map, Entity *p)
o->getComponent<CharacterComponent>();
enterMsg.writeString(
o->getComponent<BeingComponent>()->getName());
- enterMsg.writeInt8(characterComponent->getHairStyle());
- enterMsg.writeInt8(characterComponent->getHairColor());
serializeLooks(o, enterMsg);
} break;