Difference between revisions of "VESSEL2::clbkSetClassCaps"

From OrbiterWiki
Jump to navigation Jump to search
 
m
Line 7: Line 7:
 
'''virtual void''' clbkSetClassCaps'''('''[[FILEHANDLE]] cfg''');'''
 
'''virtual void''' clbkSetClassCaps'''('''[[FILEHANDLE]] cfg''');'''
  
;cfg:[[FILEHANLDE|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]], [[VESSEL2::clbkLoadStateEx|clbkLoadStateEx]]
+
;cfg:[[FILEHANDLE|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]], [[VESSEL2::clbkLoadStateEx|clbkLoadStateEx]]
  
 
==Example code==
 
==Example code==

Revision as of 17:32, 4 March 2006

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

Template:Example ArtLicense

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