JMW
Aspiring Addon Developer
:hmm:Trying to use GetNavSource () to get currently tuned radio (ILS) for an Autopilot.
DWORD padNo;
VESSEL3 *vessel;
presently under
heading.
Code I'm trying is:
VTOL section works fine (that is without bold section ) -
but get ctd when section added.
Not sure of my use of "vessel->" - this is where my coding 'skills' get hazy ...
Can anyone help?
DWORD padNo;
VESSEL3 *vessel;
presently under
Code:
// ==============================================================
// Some vessel parameters
// ==============================================================
Code I'm trying is:
PHP:
bool InputTarget(void *id, char *bstr, void *user_data)
{
oapiSetHUDMode (HUD_SURFACE);
OBJHANDLE hPlanet = oapiGetGbodyByName("Earth");//GetSurfaceRef();//
OBJHANDLE hBase = oapiGetBaseByName(hPlanet, bstr);
if (hBase == NULL) return false;
int nBase=oapiGetBaseCount(hPlanet);
for (int i=0; i< nBase; i++) {
base = bstr;
}
if (hBase != NULL)
[B]NAVHANDLE nv = NULL;
NAVHANDLE nv = vessel->GetNavSource (0);
if (nv)
{
nvtype = oapiGetNavType(nv);
if (nvtype != TRANSMITTER_VOR && nvtype != TRANSMITTER_ILS)
nv = NULL;
if (nvtype == TRANSMITTER_ILS)
{
sprintf(oapiDebugString(),"ILS FOUND %02.2f ",nvtype);//Just to show something's happened
}
}
else[/B]
{
int status = 1;
DWORD padcount = oapiGetBasePadCount(hBase);
NAVHANDLE hNav = NULL;
for (DWORD i = 0; i < padcount && status >0; i++) {
oapiGetBasePadStatus(hBase, i, &status);
Nav = 1;
//{sprintf(oapiDebugString(),"Pad No %02.2f ", status);}
hNav = oapiGetBasePadNav(hBase, i);
padNo = i+1;
if (hNav != NULL)
navtype = oapiGetNavType(hNav);
//if (navtype == TRANSMITTER_VTOL)
{
oapiGetBasePadEquPos(hBase, i, &tgtlng, &tgtlat, &tgtrad);
//sprintf(oapiDebugString(),"Target VTOL long %01.08f : lat %01.08f : Base %01.08f : Pad %01.03f", tgtlng, tgtlat, str, i+1);
Nav = 1;
}
}
}
OBJHANDLE hRef = hBase;
return true;
}
VTOL section works fine (that is without bold section ) -
but get ctd when section added.
Not sure of my use of "vessel->" - this is where my coding 'skills' get hazy ...
Can anyone help?
Last edited: