[Solved] Config Node Rounding Issue - Silly me!

Recommended Posts

Hello everyone,

Whitecat again! Another issue hindering my progress has popped up lately;

I am saving values to a config node for example:

ConfigNode newVessel = new ConfigNode("VESSEL")

newVessel.AddValue("SMA", vessel.orbitDriver.orbit.semiMajorAxis);

Upon saving the node to a file, a rounded version of the actual semiMajorAxis is saved, this happens regardless of adding   .ToString() or .ToString("F3") etc. For example, rounding to 6643460

To check I printed the semi major axis in the debug log and the actual value was displayed;


With the actual value being 6643459.62314,

Can anyone explain this and provide some work around?

My Orbital Decay mod requires precise values and for some reason the ConfigNode system wants to round values. - This seems to be a recent issue, I cannot remember the same thing occurring  before KSP 1.0.4.



Edited by Whitecat106

Share this post

Link to post
Share on other sites

Ignore this one, was an issue between floats and doubles - converting from a double to a float under some circumstances will round the double to the nearest integer!

Share this post

Link to post
Share on other sites
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.