| 465 | #endif |
| 466 | |
| 467 | // common case - used for scalar types |
| 468 | template <class Type> |
| 469 | float RefNetworkDataTyped<Type>::CalculateError(NetworkMessageErrorType type, const RefNetworkDataTyped<Type>& with, |
| 470 | NetworkMessageFormatItem& item, float dt) const |
| 471 | { |
| 472 | const Type& value = GetVal(); |
| 473 | const Type& withValue = with.GetVal(); |
| 474 | |
| 475 | switch (type) |
| 476 | { |
| 477 | case ET_NOT_EQUAL: |
| 478 | return value != withValue ? 1 : 0; |
| 479 | case ET_ABS_DIF: |
| 480 | return fabs(value - withValue); |
| 481 | case ET_SQUARE_DIF: |
| 482 | return Square(value - withValue); |
| 483 | case ET_DER_DIF: |
| 484 | return dt * fabs(value - withValue); |
| 485 | default: |
| 486 | Fail("Unexpected error type"); |
| 487 | return 0; |
| 488 | } |
| 489 | } |
| 490 |
nothing calls this directly
no test coverage detected