OHM Extended planetary parameters SDK 0.11

Ahh, prompted by Urwumpe's post: the compiler output a metric tonne of warnings related to use of sscanf instead of sscanf_s and the like. I'm currently reading http://www.securecoding.cert.org/, plenty of food for thought there...
 
Seriously: For Orbiter, it doesn't mind if you use the unsafe version, since orbiter add-ons are hardly an attack vector for computers. But at the same time, it does not kill you to use the robust versions of the functions and have proper buffer size handling.
 
the compiler output a metric tonne of warnings related to use of sscanf instead of sscanf_s and the like.

ah, yes. You should see the warnings list in orbiter galaxy :lol:

I'm discovering more of the EPP API bit by bit.

That'll be a pretty short discovery trip, there's not much API. All functions are described in the manual and in the sample, there's really nothing more to it.
 
ah, yes. You should see the warnings list in orbiter galaxy :lol:

You should better fix them as hard, as you fix errors, warnings are errors in the making. ;)
 
jedidia, am having an Apollo 13 flashback. I've integrated EPP into PrecMFD, but the following code and stock Sol.epp give me some problems:
Code:
#include "EPP.h"
#include <string>
#include <iostream>

using namespace std;

int main()
{
	//fills MySystem with the data loaded from the Sol.epp file. Returns NULL if no file found.
	if (EPP_System* MySystem = EPP_LoadSystem("Sol"))									
	{
		for (int i = 1; i<MySystem->numPlanets+1; i++)
		{
				EPP_Body* planet= MySystem->GetBodyByIndex(i, 0);
				if (planet==NULL) continue;
				std::string AtmoDescription = MySystem->Describe_Atmosphere(planet);
				cout<<planet->Name << ":" << AtmoDescription<<endl;
		};
		delete MySystem;																
	};
}

The bug is as follows: Venusian atmosphere is not available, while Jupiter and Saturn are available although the Sol.epp file doesn't define their atmospheres yet.

Another item: have you considered that moons can have atmospheres (Titan and the Avatar planet :) )?

Would also be fine to iterate through all the bodies.

TIA, Wishbone
 
This is... weird. There seems to be a serious bug, for some reason Venus isn't read from the file at all, the pointer just returns NULL. I'll have that fixed ASAP.

The Gas giants shouldn't have any atmosphere compounds defined, and their atmospheric pressure is infinity. This is rather strange, since the parser works without trouble in Orbiter Galaxy. Something must have gotten messed up when I took it over to EPP, and quite subtley at that.

Another item: have you considered that moons can have atmospheres (Titan and the Avatar planet :) )?

Why, of course. The .epp just isn't finished yet, so there are not really much parameters available for the moons of the gas giants yet (it's rather tedious getting all that data together, it took me a few hours just to get the file to where it is now. If you'd like to fill out some of the missing data, I'd be very happy), but that's not an EPP issue per se, it's just that the file is incomplete. The other thing, however, is somewhat worrying, and will probably demand a bugfix. I'll let you know when I know what on earth (or on venus) is going on there...

Would also be fine to iterate through all the bodies.

Code:
for (int i = 1; i<MySystem->numPlanets+1; i++)
{

    EPP_Planet* CurPlanet = MySystem->GetPlanetByIndex(i);
    for (int j = 0; j < CurPlanet.moons + 1; ++j) 
    {
	EPP_Body* planet= MySystem->GetBodyByIndex(i, j);
   }
}

OR:

for (int i = 1; i<MySystem->numPlanets+1; i++)
{

    EPP_Planet* CurPlanet = MySystem->GetPlanetByIndex(i);
    for (int j = 0; j < CurPlanet.moons + 1; ++j) 
   {
	EPP_Body* planet= &CurPlanet.Bodies[j];
   }
}


---------- Post added at 09:33 PM ---------- Previous post was at 09:21 PM ----------

Ok... nothing wrong with the parser, but the GetBodyByIndex function has a serious hickup (guess what... when it checkes the boundary of the array, it falls one short. I.E. the last moon of any planet is not accessible, or, if the planet has no moon, the planet itself...) The bodies are there in memory and can be accessed with the second method described above. I'll have that function fixed in no time.

Also, I don't know where you got atmospheric data for the gas giants from (other than infinite pressure, which is used to identify that it is a gas giant and atmospheric surface pressure isn't really a meaningful parameter).

---------- Post added at 10:01 PM ---------- Previous post was at 09:33 PM ----------

Bugfix is up, Sorry for the trouble. The same bug was also present in GetBodyByName. If only I tried this with Venus or Mercury instead of earth I would have noticed... I also removed the ton of warnings, as was suggested.
 
Last edited:
Venus is back, thanks! Will send you my mods to Sol.epp as time allows.
 
Uh, been a long time. I fulfil my promise and attach my current Sol.epp.

Am wondering if it is possible to specify some crude albedo and planetary IR models (spline coefficients, perhaps) within EPP, or I should petition for a separate DLL for all that :)
 

Attachments

Back
Top