1
0
Fork 0

src/AIModel/AIMultiplayer.cxx: fixed some replay unevenness.

We previously ignored mp packets if their .time was very different from local
time, but this stops time-compensation (e.g. with simple-time) from working and
is unnecessary because we clean up old packets anyway.

Also removed unnecessary erase of mp packets after interpolation.
This commit is contained in:
Julian Smith 2021-06-10 07:09:03 +01:00
parent d77606cbe9
commit 411953e89b

View file

@ -238,13 +238,6 @@ void FGAIMultiplayer::FGAIMultiplayerInterpolate(
++nextPropIt; ++nextPropIt;
} }
} }
// Now throw away too old data
if (prevIt != mMotionInfo.begin())
{
--prevIt;
mMotionInfo.erase(mMotionInfo.begin(), prevIt);
}
} }
void FGAIMultiplayer::FGAIMultiplayerExtrapolate( void FGAIMultiplayer::FGAIMultiplayerExtrapolate(
@ -645,6 +638,7 @@ void FGAIMultiplayer::update(double dt)
else if (nextIt == mMotionInfo.begin()) else if (nextIt == mMotionInfo.begin())
{ {
// Leave prevIt and nextIt pointing at same item. // Leave prevIt and nextIt pointing at same item.
SG_LOG(SG_GENERAL, SG_DEBUG, "Only one frame for interpolation: " << _callsign);
} }
else else
{ {
@ -758,18 +752,6 @@ FGAIMultiplayer::addMotionInfo(FGExternalMotionData& motionInfo,
{ {
mLastTimestamp = stamp; mLastTimestamp = stamp;
if (!mMotionInfo.empty()) {
double diff = motionInfo.time - mMotionInfo.rbegin()->first;
// packet is very old -- MP has probably reset (incl. his timebase)
if (diff < -10.0)
mMotionInfo.clear();
// drop packets arriving out of order
else if (diff < 0.0)
return;
}
if (m_simple_time_enabled->getBoolValue()) { if (m_simple_time_enabled->getBoolValue()) {
// Update simple-time stats and set m_simple_time_compensation. // Update simple-time stats and set m_simple_time_compensation.
// //