Dragonfly Q&A

Objects destructor

0 like 0 dislike
Should the object destructor remove itself from the ObjectList in the WorldManager? if it should, would it create a loop when the function "update" in WorldManager delete the Object from the WorldManager's "updates" ObjectList?
Dragonfly version 4.2
asked Sep 17, 2016 in Engine Development by linh

1 Answer

0 like 0 dislike
<p>The Object destructor (~Object()) asks the WorldManager to remove it from the game world.  See page 105 of the book (version 4) for a listing.

<p>There is no "loop" here - rather, the WorldManager just removes the Object from the updates ObjectList.  Note, the Object destructor is called automatically when the delete is called (by the WorldManager at the end of update, assuming markForDelete() was called).

<p>See Section 4.5.8 "Program Flow for Game Objects" for clarification on the life-cycle for game objects.
answered Sep 18, 2016 by claypool
More information about Dragonfly can be found on the Dragonfly Home Page.
...