VESSEL2::clbkSetClassCaps

From OrbiterWiki
Revision as of 17:39, 4 March 2006 by Urwumpe (talk | contribs)
Jump to navigation Jump to search

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.

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

Example code

void MAYFLY::clbkSetClassCaps(FILEHANDLE cfg)
{
	this->SetEnableFocus(false);
	char* pLine;
	while(oapiReadScenario_nextline(cfg, pLine))
	{
		if(!strnicmp(pLine, "LifeTime", 8))
		{
			char* pLine2 = pLine + 8;
			while(*pLine2 != '=' && *pLine2 != '\0')
			{
				pLine2++;
			}
			if(*pLine2 != '\0')
			{
				pLine2++;
				sscanf(pLine2, "%lf", &fRemainingLifeTime);
			}

		}
		else if(!strnicmp(pLine, "MaxCamDistance", 14))
		{
			char* pLine2 = pLine + 14;
			while(*pLine2 != '=' && *pLine2 != '\0')
			{
				pLine2++;
			}
			if(*pLine2 != '\0')
			{
				pLine2++;
				sscanf(pLine2, "%lf", &fMaxCameraDistance);
			}

		}
	}
}

See also