Difference between revisions of "VESSEL2::clbkSetClassCaps"

From OrbiterWiki
Jump to navigation Jump to search
m
Line 55: Line 55:
 
*[[VESSEL2]]
 
*[[VESSEL2]]
  
 +
{{VESSEL2}}
 
[[Category:OrbiterSDK|VESSEL2::clbkSetClassCaps]]
 
[[Category:OrbiterSDK|VESSEL2::clbkSetClassCaps]]
 
[[Category:VESSEL2|clbkSetClassCaps]]
 
[[Category:VESSEL2|clbkSetClassCaps]]
 
[[Category:Callback functions]]
 
[[Category:Callback functions]]

Revision as of 16:59, 12 June 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

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

Callback functions in VESSEL2

edit

clbkADCtrlMode - clbkAnimate - clbkConsumeBufferedKey - clbkConsumeDirectKey - clbkDockEvent - clbkDrawHUD - clbkHUDMode - clbkLoadGenericCockpit - clbkLoadPanel - clbkLoadStateEx - clbkLoadVC - clbkMFDMode - clbkNavMode - clbkPanelMouseEvent - clbkPanelRedrawEvent - clbkPostCreation - clbkPostStep - clbkPreStep - clbkRCSMode - clbkSaveState - clbkSetClassCaps - clbkSetStateEx - clbkVCMouseEvent - clbkVCRedrawEvent - clbkVisualCreated - clbkVisualDestroyed