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

Method readNetDelta

source/core/StarNetElementBasicFields.hpp:247–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245
246template <typename T>
247void NetElementBasicField<T>::readNetDelta(DataStream& ds, float interpolationTime, NetCompatibilityRules rules) {
248 if (!checkWithRules(rules)) return;
249 T t;
250 readData(ds, t);
251 m_latestUpdateVersion = m_netVersion ? m_netVersion->current() : 0;
252 if (m_pendingInterpolatedValues) {
253 // Only append an incoming delta to our pending value list if the incoming
254 // step is forward in time of every other pending value. In any other
255 // case, this is an error or the step tracking is wildly off, so just clear
256 // any other incoming values.
257 if (interpolationTime > 0.0f && (m_pendingInterpolatedValues->empty() || interpolationTime >= m_pendingInterpolatedValues->last().first)) {
258 m_pendingInterpolatedValues->append({interpolationTime, std::move(t)});
259 } else {
260 m_value = std::move(t);
261 m_pendingInterpolatedValues->clear();
262 updated();
263 }
264 } else {
265 m_value = std::move(t);
266 updated();
267 }
268}
269
270template <typename T>
271void NetElementBasicField<T>::updated() {

Callers

nothing calls this directly

Calls 5

currentMethod · 0.45
emptyMethod · 0.45
lastMethod · 0.45
appendMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected