Editing VESSEL2::clbkSetClassCaps
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 7: | Line 7: | ||
'''virtual void''' clbkSetClassCaps'''('''[[FILEHANDLE]] cfg''');''' | '''virtual void''' clbkSetClassCaps'''('''[[FILEHANDLE]] cfg''');''' | ||
− | ;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]] |
==Example code== | ==Example code== | ||
+ | {{Example ArtLicense}} | ||
<pre> | <pre> | ||
void MAYFLY::clbkSetClassCaps(FILEHANDLE cfg) | void MAYFLY::clbkSetClassCaps(FILEHANDLE cfg) | ||
{ | { | ||
this->SetEnableFocus(false); | this->SetEnableFocus(false); | ||
− | + | char* pLine; | |
− | + | while(oapiReadScenario_nextline(cfg, pLine)) | |
− | |||
− | char | ||
− | |||
− | |||
{ | { | ||
− | + | 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( | + | else if(!strnicmp(pLine, "MaxCamDistance", 14)) |
{ | { | ||
− | + | char* pLine2 = pLine + 14; | |
+ | while(*pLine2 != '=' && *pLine2 != '\0') | ||
+ | { | ||
+ | pLine2++; | ||
+ | } | ||
+ | if(*pLine2 != '\0') | ||
+ | { | ||
+ | pLine2++; | ||
+ | sscanf(pLine2, "%lf", &fMaxCameraDistance); | ||
+ | } | ||
+ | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
Line 54: | Line 55: | ||
*[[Vessel module sequence diagram]] | *[[Vessel module sequence diagram]] | ||
*[[VESSEL2]] | *[[VESSEL2]] | ||
− | |||
− | |||
− | |||
[[Category:OrbiterSDK|VESSEL2::clbkSetClassCaps]] | [[Category:OrbiterSDK|VESSEL2::clbkSetClassCaps]] | ||
[[Category:VESSEL2|clbkSetClassCaps]] | [[Category:VESSEL2|clbkSetClassCaps]] | ||
[[Category:Callback functions]] | [[Category:Callback functions]] |