| 405 | } |
| 406 | |
| 407 | TMError NetworkObject::TransferMsg(NetworkMessageContext& ctx) |
| 408 | { |
| 409 | if (ctx.IsSending()) |
| 410 | { |
| 411 | // TESTING - Replace by PoseidonAssert |
| 412 | NET_ERROR(dynamic_cast<const IndicesNetworkObject*>(ctx.GetIndices())) |
| 413 | const IndicesNetworkObject* indices = static_cast<const IndicesNetworkObject*>(ctx.GetIndices()); |
| 414 | |
| 415 | NetworkId id = GetNetworkId(); |
| 416 | TMCHECK(ctx.IdxTransfer(indices->objectCreator, id.creator)) |
| 417 | TMCHECK(ctx.IdxTransfer(indices->objectId, id.id)) |
| 418 | Vector3 position = GetCurrentPosition(); |
| 419 | TMCHECK(ctx.IdxTransfer(indices->objectPosition, position)) |
| 420 | } |
| 421 | else |
| 422 | { |
| 423 | if (ctx.GetClass() == NMCUpdatePosition) |
| 424 | { |
| 425 | _lastUpdateTime = Glob.time; |
| 426 | _maxPredictionTime = _lastUpdateTime + GetMaxPredictionTime(ctx); |
| 427 | } |
| 428 | } |
| 429 | return TMOK; |
| 430 | } |
| 431 | |
| 432 | float NetworkObject::CalculateError(NetworkMessageContext& ctx) |
| 433 | { |
no test coverage detected