API Question DetachChild

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
Code:
	 /**
	 * \brief Break an existing attachment to a child.
	 * \param attachment attachment handle
	 * \param vel separation velocity [m/s]
	 * \return \e true when detachment is successful, \e false if no child was
	 *   attached, or [COLOR="Red"]if child refuses to detach[/COLOR].
	 * \sa CreateAttachment, SetAttachmentParams, GetAttachmentParams,
	 *   GetAttachmentId, GetAttachmentStatus, AttachmentCount, GetAttachmentIndex,
	 *   GetAttachmentHandle, AttachChild
	 */
	bool DetachChild (ATTACHMENTHANDLE attachment, double vel = 0.0) const;
How would that be achieved? I looked in all of the API and there appears to be nothing to do this with.
There is a clbkDockEvent(), which (an "attachment version" of that callback) would probably be a good way to allow the child to do the check, but that callback returns void instead of bool, so this can't even be done to the docking ports...
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
Not sure how this was meant to be, but what happens in this scenario:

A (parent) and B(child) are docked,
then B deletes the docking port [via DelAttachment(...)]
and A tries to detach [via DetachChild(...)] using a previously[*] stored ATTACHMENTHANDLE (which it shouldn't do).


[*] "previously" as in before the detaching attempt of child B

Could that lead to a negative (false) return?

On the other hand, I agree that there doesn't seem to be a clean interface to reject/refuse detaching of a child or parent.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
Not sure how this was meant to be, but what happens in this scenario:

A (parent) and B(child) are docked,
then B deletes the docking port [via DelAttachment(...)]
and A tries to detach [via DetachChild(...)] using a previously[*] stored ATTACHMENTHANDLE (which it shouldn't do).


[*] "previously" as in before the detaching attempt of child B

Could that lead to a negative (false) return?
Without testing, I'd say that would either CTD or return false.
 

kuddel

Donator
Donator
Joined
Apr 1, 2008
Messages
2,064
Reaction score
507
Points
113
I would guess that the "child refuse to detach" part is a left-over from an idea Martin had...
Current HEAD version of Orbiter BETA repository also doesn't have any additional API regarding attachments, so I guess it's just a "misleading" comment.
 

GLS

Well-known member
Orbiter Contributor
Addon Developer
Joined
Mar 22, 2008
Messages
5,914
Reaction score
2,908
Points
188
Website
github.com
I would guess that the "child refuse to detach" part is a left-over from an idea Martin had...
... or never finished... :shrug:
 
Top