MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / CalculateError

Method CalculateError

engine/Poseidon/Network/NetworkMsg.cpp:467–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465#endif
466
467// common case - used for scalar types
468template <class Type>
469float 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

Callers

nothing calls this directly

Calls 15

fabsFunction · 0.85
CompareRot8bFunction · 0.85
minFunction · 0.85
absFunction · 0.85
DirectionUpMethod · 0.80
GetServerMethod · 0.80
TransferMsgSimpleMethod · 0.80
AUTO_STATIC_ARRAYFunction · 0.70
SquareFunction · 0.50
stricmpFunction · 0.50
Distance2Method · 0.45
DistanceMethod · 0.45

Tested by

no test coverage detected