diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-06 21:36:50 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-04-11 13:43:00 +0200 |
commit | aa04597c5f8bb806996d604699fc8ebff6d53bdd (patch) | |
tree | 20e6a79a873605b62c80011fd5c80351f60df6fb /src/serialize | |
parent | d95fccfca8575d8fb06988e558a338e37776961a (diff) | |
download | manaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.tar.gz manaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.tar.xz manaserv-aa04597c5f8bb806996d604699fc8ebff6d53bdd.zip |
Converted the Character class into a component
A CharacterData was created as a proxy class in order to allow using the
old serialization method.
Diffstat (limited to 'src/serialize')
-rw-r--r-- | src/serialize/characterdata.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/serialize/characterdata.h b/src/serialize/characterdata.h index abcc611..c25fb09 100644 --- a/src/serialize/characterdata.h +++ b/src/serialize/characterdata.h @@ -42,16 +42,14 @@ void serializeCharacterData(const T &data, MessageOut &msg) msg.writeInt16(data.getCharacterPoints()); msg.writeInt16(data.getCorrectionPoints()); - msg.writeInt16(data.mAttributes.size()); - AttributeMap::const_iterator attr_it, attr_it_end; - for (attr_it = data.mAttributes.begin(), - attr_it_end = data.mAttributes.end(); - attr_it != attr_it_end; - ++attr_it) + + const AttributeMap &attributes = data.getAttributes(); + msg.writeInt16(attributes.size()); + for (auto attributeIt : attributes) { - msg.writeInt16(attr_it->first); - msg.writeDouble(data.getAttrBase(attr_it)); - msg.writeDouble(data.getAttrMod(attr_it)); + msg.writeInt16(attributeIt.first); + msg.writeDouble(attributeIt.second.getBase()); + msg.writeDouble(attributeIt.second.getModifiedAttribute()); } // character skills @@ -66,11 +64,11 @@ void serializeCharacterData(const T &data, MessageOut &msg) // status effects currently affecting the character msg.writeInt16(data.getStatusEffectSize()); - std::map<int, int>::const_iterator status_it; + std::map<int, Status>::const_iterator status_it; for (status_it = data.getStatusEffectBegin(); status_it != data.getStatusEffectEnd(); status_it++) { msg.writeInt16(status_it->first); - msg.writeInt16(status_it->second); + msg.writeInt16(status_it->second.time); } // location |