Editing Storing MFD Instances
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 1: | Line 1: | ||
− | In Orbiter, if you switch focus to another vessel, or switch camera modes, the [[MFD]]s that are open get deleted. This is because [[MFD]]s are strictly designed for displaying data. But what if you were writing an [[MFD]] that needed to cache data? For example, a user defined value. Every time the user switches focus, or camera modes, the [[MFD]] will get destroyed. This article shows how you can bypass this problem | + | In Orbiter, if you switch focus to another vessel, or switch camera modes, the [[MFD]]s that are open get deleted. This is because [[MFD]]s are strictly designed for displaying data. But what if you were writing an [[MFD]] that needed to cache data? For example, a user defined value. Every time the user switches focus, or camera modes, the [[MFD]] will get destroyed. This article shows how you can bypass this problem. |
== Basic Plan == | == Basic Plan == | ||
Line 58: | Line 58: | ||
{ | { | ||
// match found! | // match found! | ||
− | if (g_data | + | if (g_data[i]->hook==vessel->GetHandle()) |
{ | { | ||
// cache the pointer | // cache the pointer | ||
− | this->data=g_data | + | this->data=g_data[i]; |
found=true; | found=true; | ||
break; | break; | ||
Line 90: | Line 90: | ||
} | } | ||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |