Showing the changes to libraries/physics/src/ObjectActionSpring.cpp (1 of 7 files). Show all
Unified · Split
| @@ -11,6 +11,8 @@ · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | #include "ObjectActionSpring.h" |
| 13 | 13 | |
| 14 | +const uint16_t ObjectActionSpring::springVersion = 1; | |
| 15 | + | |
| 14 | 16 | ObjectActionSpring::ObjectActionSpring(EntityActionType type, QUuid id, EntityItemPointer ownerEntity) : |
| 15 | 17 | ObjectAction(type, id, ownerEntity) { |
| 16 | 18 | #if WANT_DEBUG |
| @@ -149,6 +151,7 @@ QByteArray ObjectActionSpring::serialize() { · 132 unmodified lines | ||
| 149 | 151 | |
| 150 | 152 | dataStream << getType(); |
| 151 | 153 | dataStream << getID(); |
| 154 | + dataStream << ObjectActionSpring::springVersion; | |
| 152 | 155 | |
| 153 | 156 | dataStream << _positionalTarget; |
| 154 | 157 | dataStream << _linearTimeScale; |
| @@ -166,11 +169,16 @@ void ObjectActionSpring::deserialize(QByteArray serializedArguments) { · 11 unmodified lines | ||
| 166 | 169 | |
| 167 | 170 | EntityActionType type; |
| 168 | 171 | QUuid id; |
| 172 | + uint16_t serializationVersion; | |
| 169 | 173 | |
| 170 | 174 | dataStream >> type; |
| 171 | − dataStream >> id; | |
| 172 | 175 | assert(type == getType()); |
| 176 | + dataStream >> id; | |
| 173 | 177 | assert(id == getID()); |
| 178 | + dataStream >> serializationVersion; | |
| 179 | + if (serializationVersion != ObjectActionSpring::springVersion) { | |
| 180 | + return; | |
| 181 | + } | |
| 174 | 182 | |
| 175 | 183 | dataStream >> _positionalTarget; |
| 176 | 184 | dataStream >> _linearTimeScale; |