Go Back   Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK
Register Blogs Orbinauts List Social Groups FAQ Projects Mark Forums Read

Orbiter SDK Orbiter software developers post your questions and answers about the SDK, the API interface, LUA, meshing, etc.

Thread Tools
Old 03-07-2019, 03:02 PM   #1
Addon Developer

Default Bug found in GetExhaustSpec

Hi guys,

I think I found a bug in the function GetExhaustSpec(UINT idx, EXHAUSTSPEC* spec) and it seems to me that is present also in the other version of GetExhaustSpec.

Apparently the idx the function is reading is the exhaust counter and not the ID of the exhaust: when I delete an exhaust that is not the last of the list and I use the function with the latest ID orbiter crashes and from the debug it comes out that it crashes because the spec is rubbish.
I made a check printing out all the exhaust ID in the sim and I am calling the right ID, but if I delete an intermediate exhaust the function does not work anymore.
The only way I found to make it work is the following:
UINT ID =  the ID I want to check
for (DWORD i = 0; i < VB1->GetExhaustCount(); i++) {
		VB1->GetExhaustSpec(i, &es);
		if (es.id == ID) {
I hope I made myself clear enough.

Tested only in Orbiter2016, not in beta.

fred18 is offline   Reply With Quote
Old 03-07-2019, 04:39 PM   #2
O-F Administrator
dbeachy1's Avatar


Per the docs for GetExhaustSpec:
* \param [in] idx exhaust identifier
That parameter is `UINT idx` (an unsigned integer, not a HANDLE), and "idx" means "index". To me, it reads as if it's working as designed: that it's an index between 0 and (GetExhaustCount()-1), and so if you delete an intermediate exhaust then all the exhaust indexes above its position in the list will shift. Therefore, you can't assume the same exhaust index will always remain valid across multiple frames if you delete any exhausts. Also, if the behavior of this method were to change, it would break every add-on out there that currently uses it.

If you need to maintain a reference to a given exhaust spec, you can just store the EXHAUSTSPEC * you initially pass to AddExhaust rather than trying to re-retrieve that spec pointer later by calling GetExhaustSpec. In other words, you shouldn't need to use GetExhaustSpec to keep track of or modify your own exhaust specs that your own vessel code creates -- GetExhaustSpec() is only necessary if you need to enumerate and read other vessels' exhaust specs. Does that all make sense?
dbeachy1 is offline   Reply With Quote
Old 03-07-2019, 08:10 PM   #3
Addon Developer


I understand what you mean but TBH I do not agree, and I think that there are clues that I am right about this:

1) the AddExhaust function returns the UINT which the docs call "Exhaust identifier" and to me an identifier is used to identify uniquely.
2) the id reserved parameter of Exhaustspec remains the same, as a matter of fact my workaround of the issue works. So they actually do not shift. I am sure about this because I checked with a series of exhausts added and deleted and the id always remained the same.
3) If what you say is true, the function GetExhaustSpec doesn't make much sense, since it could basically only be used in a loop cycle through all the specs.

The fact that the identifier is a UINT and not a Handle doesn't change much, a handle is just an alias for any kind of implementaiton behind an identifier, in this case the implementation is shown and not hidden.

It seems pretty clear to me that the original intention was to return through the addexhaust the identifier that is stored in the exhaustspec id reserved parameter and let the users recall the spec using the id, so I pretty much think it's a bug. And I also think that there are not many addons that use this particular function, since usually the exhaust are just added and get deleted with the relevant engine, so it is quite rare to query the sim for their parameters, I think that is why this thing never came out before.

I could be wrong of course, only martins can tell us the true story

---------- Post added at 21:10 ---------- Previous post was at 18:00 ----------

In addition, to what above said the DelExhaust function accepts just the UINT idx as a parameter, so even though I could retrieve the specs from what I created, I surely need to be able to delete a specific exhaust, and the only identifier is the ID, so to me this is a further confirmation that even though it is not a show stopper, the GetExhaustSpec has a bug
fred18 is offline   Reply With Quote

  Orbiter-Forum > Orbiter Space Flight Simulator > Orbiter SDK

Thread Tools

Posting Rules
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump

All times are GMT. The time now is 05:46 AM.

Quick Links Need Help?

About Us | Rules & Guidelines | TOS Policy | Privacy Policy

Orbiter-Forum is hosted at Orbithangar.com
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 2007 - 2017, Orbiter-Forum.com. All rights reserved.