Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for issue #714, sending whole science amount at the end instead of just a small delta amount #715

Merged
merged 3 commits into from Jan 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/RemoteTech/Modules/ModuleRTDataTransmitter.cs
Expand Up @@ -24,12 +24,6 @@ public String
private bool isBusy;
private readonly List<ScienceData> scienceDataQueue = new List<ScienceData>();

/// <summary> When a transmission almost succeed but not totally (issue #667),
/// e.g. the probe transmitted 9.999999 instead of 10 due to a floating point error in KSP.
/// We use this constant value as a size to be added to the last sent packet.
/// </summary>
private const float LastPacketAddtionalSize = 0.1f;

// Compatible with ModuleDataTransmitter
public override void OnLoad(ConfigNode node)
{
Expand Down Expand Up @@ -150,12 +144,12 @@ private IEnumerator Transmit(Callback callback = null)
// check if it's the last packet to send
if (packets == 0)
{
// issue #667 ; floating point error in RnDCommsStream.StreamData method when adding to dataIn private field
// issue #667, issue #714 ; floating point error in RnDCommsStream.StreamData method when adding to dataIn private field
// e.g scienceData.dataAmount is 10 but in the end RnDCommsStream.dataIn will be 9.999999, so the science never
// gets registered to the ResearchAndDevelopment center.
// we just need to add a little amount to the last packet so it goes over the packet size:
// Let's just go ahead and send the full amount so there's no question if we sent it all
// KSP will clamp the final size to PacketSize anyway.
frame += LastPacketAddtionalSize;
frame = scienceData.dataAmount;
}

commStream.StreamData(frame, vessel.protoVessel);
Expand Down