VESSEL2::clbkSetClassCaps
From OrbiterWiki
Contents |
[edit] Description
Callback function used for creating the basic vessel parameters. Each setting in this callback overrides the settings of the configuration file. Use this function for creating the physical properties of a vessel.
[edit] Syntax
virtual void clbkSetClassCaps(FILEHANDLE cfg);
- cfg
- File handle for reading custom parameters out of the configuration file. This file handle can be used in the same way as in ovcSetClassCaps, ovcLoadStateEx, ovcLoadState, clbkLoadStateEx
[edit] Example code
void MAYFLY::clbkSetClassCaps(FILEHANDLE cfg)
{
this->SetEnableFocus(false);
double dfTemp = 0.0;
char pszBuffer[80];
if(oapiReadItem_float(cfg, "LifeTime", dfTemp))
{
fRemainingLifeTime = dfTemp;
}
if(oapiReadItem_float(cfg, "MaxCamDistance", dfTemp))
{
fMaxCameraDistance = dfTemp;
}
if(oapiReadItem_string(cfg, "Subtype", pszBuffer))
{
if(!strnicmp(pszBuffer, "flare", 5))
{
}
else if(!strnicmp(pszBuffer, "sflare", 6))
{
subtype = MTYPE_SFLARE;
}
}
switch(subtype)
{
case MTYPE_SFLARE:
CreateAsSFlare();
break;
}
}