diff options
Diffstat (limited to 'src/game-server/character.cpp')
-rw-r--r-- | src/game-server/character.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index 74df2122..0944f757 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -223,12 +223,19 @@ void CharacterComponent::serialize(Entity &entity, MessageOut &msg) const AttributeMap &attributes = beingComponent->getAttributes(); - msg.writeInt16(attributes.size()); - for (auto attributeIt : attributes) + std::map<const AttributeInfo *, const Attribute *> attributesToSend; + for (auto &attributeIt : attributes) + { + if (attributeIt.first->persistent) + attributesToSend.insert(std::make_pair(attributeIt.first, + &attributeIt.second)); + } + msg.writeInt16(attributesToSend.size()); + for (auto &attributeIt : attributesToSend) { msg.writeInt16(attributeIt.first->id); - msg.writeDouble(attributeIt.second.getBase()); - msg.writeDouble(attributeIt.second.getModifiedAttribute()); + msg.writeDouble(attributeIt.second->getBase()); + msg.writeDouble(attributeIt.second->getModifiedAttribute()); } // status effects currently affecting the character |