| 245 | |
| 246 | template <typename T> |
| 247 | void 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 | |
| 270 | template <typename T> |
| 271 | void NetElementBasicField<T>::updated() { |