MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / netLoad

Method netLoad

source/core/StarNetElementDynamicGroup.hpp:179–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177
178template <typename Element>
179void 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
202template <typename Element>
203bool NetElementDynamicGroup<Element>::writeNetDelta(DataStream& ds, uint64_t fromVersion, NetCompatibilityRules rules) const {

Callers 1

readNetDeltaMethod · 0.45

Calls 5

readVlqUMethod · 0.80
clearMethod · 0.45
currentMethod · 0.45
addMethod · 0.45
takeDataMethod · 0.45

Tested by

no test coverage detected