| 177 | |
| 178 | template <typename Element> |
| 179 | void NetElementDynamicGroup<Element>::netLoad(DataStream& ds, NetCompatibilityRules rules) { |
| 180 | if (!checkWithRules(rules)) return; |
| 181 | m_changeData.clear(); |
| 182 | m_changeDataLastVersion = m_netVersion ? m_netVersion->current() : 0; |
| 183 | m_idMap.clear(); |
| 184 | |
| 185 | addChangeData(ElementReset()); |
| 186 | |
| 187 | uint64_t count = ds.readVlqU(); |
| 188 | |
| 189 | for (uint64_t i = 0; i < count; ++i) { |
| 190 | ElementId id = ds.readVlqU(); |
| 191 | DataStreamBuffer storeBuffer(ds.read<ByteArray>()); |
| 192 | |
| 193 | ElementPtr element = make_shared<Element>(); |
| 194 | element->netLoad(storeBuffer, rules); |
| 195 | readyElement(element); |
| 196 | |
| 197 | m_idMap.add(id, std::move(element)); |
| 198 | addChangeData(ElementAddition(id, storeBuffer.takeData())); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | template <typename Element> |
| 203 | bool NetElementDynamicGroup<Element>::writeNetDelta(DataStream& ds, uint64_t fromVersion, NetCompatibilityRules rules) const { |