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

Method readNetDelta

source/core/StarNetElementGroup.cpp:90–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void NetElementGroup::readNetDelta(DataStream& ds, float interpolationTime, NetCompatibilityRules rules) {
91 if (!checkWithRules(rules))
92 return;
93 if (m_elements.size() == 0) {
94 throw IOException("readNetDelta called on empty NetElementGroup");
95 } else if (m_elements.size() == 1) {
96 m_elements[0].first->readNetDelta(ds, interpolationTime, rules);
97 } else {
98 uint64_t readIndex = ds.readVlqU();
99 uint64_t i = 0;
100 uint64_t offset = 0;
101 for (auto& element : m_elements) {
102 if (!element.first->checkWithRules(rules)) {
103 offset++;
104 continue;
105 }
106 if (readIndex == 0 || readIndex - 1 > i) {
107 if (m_interpolationEnabled)
108 m_elements[i + offset].first->blankNetDelta(interpolationTime);
109 } else if (readIndex - 1 == i) {
110 m_elements[i + offset].first->readNetDelta(ds, interpolationTime, rules);
111 readIndex = ds.readVlqU();
112 } else {
113 throw IOException("group indexes out of order in NetElementGroup::readNetDelta");
114 }
115 ++i;
116 }
117 }
118}
119
120void NetElementGroup::blankNetDelta(float interpolationTime) {
121 if (m_interpolationEnabled) {

Callers

nothing calls this directly

Calls 4

readVlqUMethod · 0.80
checkWithRulesMethod · 0.80
sizeMethod · 0.45
blankNetDeltaMethod · 0.45

Tested by

no test coverage detected