NetworkObjectInfo::UpdateInfo NetworkObjectInfo::CheckBestPosition(const NetworkServer *server) const
{
Vector3 bestPos = VZero;
NetworkMessageClass bestJ = NMCUpdateN;
if (object.NotNull())
{
// find the last update of the object
Time time = TIME_MIN;
for (int j=NMCUpdateFirst; j<NMCUpdateN; j++)
{
const NetworkCurrentInfo &info = currentUpdate[j];
const NetworkMessage *msg = info.message;
if (msg)
{
if (msg->time > time)
{
time = msg->time;
bestJ = NetworkMessageClass(j);
}
}
}
//if (bestJ!=NMCUpdateN)
//{
// const auto &best = currentUpdate[bestJ];
// // retrieve position of the object
// NetworkMessageContext ctx(best.message, unconst_cast(server), best.from, MSG_RECEIVE);
// PREPARE_TRANSFER(NetworkObject)
//if (TRANSF_BASE(objectPosition, bestPos) != TMOK)
//{
// bestPos = VZero;
// bestJ = NMCUpdateN;
//}
//}
}
//DoAssert(bestJ==NMCUpdateN || bestPos!=VZero);
NetworkObjectInfo::UpdateInfo ret;
//if (bestJ!=NMCUpdateN)
//{
// ret._pos = bestPos;
// ret._updateDistance = object ? object->UpdateDistance() : FLT_MAX;
// DoAssert(object);
//}
return ret;
}