Pulsar4xDevs / Pulsar4x

A Fan work recreation of Aurora4x in C#
Other
159 stars 67 forks source link

TreeHierarchyDB Children and Parents aren't cleaned up if the DB is removed from the Entity #394

Open behindcurtain3 opened 10 months ago

behindcurtain3 commented 10 months ago

If an OrbitDB is removed from an Entity, the DB can still be referenced by the Parent or Children of other DB's in it's hierarchy. This will crash the game in the OrbitProcessor when it reaches the entity that now no longer has an OrbitDB.

se5a commented 10 months ago

Related: Orbit processer doesn't need to walk through the tree anymore, and should be faster if we don't. ~That is on my todo shortlist.~ this is now done. Position and orbits should always have the same parent, and I think children, there's probably something we can do to merge these somehow.

se5a commented 9 months ago

Can you write a test for this? Looking at the code, TreeHiraechyDB should handle this correctly.