JMW
Aspiring Addon Developer
Similar to this:http://www.orbiter-forum.com/showthread.php?t=27611&highlight=oapiOpenInputBox
I'm getting conflict (wiping data from selected base) and replacing with inputed height data, voiding autopilot.
I've tried to apply same solution to this InputBox but get errors.
What do I need to do to protect the data this time?
This code is before attempted "solution". (excuse messy coding)
Have tried
But CTD on inputing height........ Why?
I'm getting conflict (wiping data from selected base) and replacing with inputed height data, voiding autopilot.
I've tried to apply same solution to this InputBox but get errors.
What do I need to do to protect the data this time?
This code is before attempted "solution". (excuse messy coding)
Code:
bool InputHeight(void *id, char *sethgt, void *user_data)
{
//double hgt;
if (sscanf(sethgt,"%lf",&hgt, &rt) == 1 )
{
shgt = ((7.9+hgt)*0.30480);
drate = 50;
}
if (sscanf(sethgt,"%lf %lf",&hgt, &rt) == 2 )
{
shgt = ((7.9+hgt)*0.30480);
drate = rt;
}
return true;
}
bool InputTarget(void *id, char *bstr, void *user_data)
{
if(n == NULL)
{
VESSEL3 *vessel = (VESSEL3*)oapiGetFocusInterface();
oapiSetHUDMode (HUD_SURFACE);
OBJHANDLE hPlanet = oapiGetGbodyByName("Earth");
hBase = oapiGetBaseByName(hPlanet, bstr);
double lat;
double lon;
if (hBase == NULL &&sscanf_s(bstr,"%lf %lf",&lat,&lon) != 2 ) return false;
if (sscanf_s(bstr,"%lf %lf",&lon,&lat) == 2 )
{
tgtlat = lat *RAD ;
tgtlng = lon *RAD ;
hBase = NULL;
NAVType = 0;
base = bstr;
[COLOR="Red"]((ShuttlePB *)user_data)->Base = base;[/COLOR]
Nav = 1;
}
if(hBase != NULL)
{
int nBase=oapiGetBaseCount(hPlanet);
for (int i=0; i< nBase; i++) {
base = bstr;
}
[COLOR="red"]((ShuttlePB *)user_data)->Base = base;[/COLOR]
Nav = 1;
}
}
return true;
}
Have tried
Code:
char* base = NULL;
char* height = NULL;
Code:
class ShuttlePB: public VESSEL3{ //3 {
public:
......
std::string Hgt;
.....
Code:
bool InputHeight(void *id, char *sethgt, void *user_data)
{
if (sscanf(sethgt,"%lf",&hgt, &rt) == 1 )
{
height = sethgt;
((ShuttlePB *)user_data)->Hgt = height;
shgt = ((7.9+hgt)*0.30480);
drate = 50;// standard descent rate
}
if (sscanf(sethgt,"%lf %lf",&hgt, &rt) == 2 )
{
shgt = ((7.9+hgt)*0.30480);
drate = rt;
}
return true;
}
But CTD on inputing height........ Why?
Last edited: