SuperTux / supertux

SuperTux source code
https://supertux.org
GNU General Public License v3.0
2.49k stars 471 forks source link

Index intermediate classes of GameObjects, try two #3009

Closed mstoeckl closed 3 weeks ago

mstoeckl commented 1 month ago

See #2991 for details; in short, this significantly speeds up GameObjectManager::get_objects_by_type() and GameObjectManager::get_object_count(), by no longer scanning over unrelated object types.

However, the first version had an issue with disappearing objects with paths when a level was being tested from the level editor (#3008). I believe it was caused by the PathObject base class not being recorded in GameObject::get_class_types implementations. I've updated the code to do this (and also record the other intermediate classes, TriggerBase and CollisionListener, even though those are not currently searched for.) I was able to reproduce #3008 with the old version and no longer see it with the new.

mstoeckl commented 1 month ago

I've updated this PR to account for the new Boss and BigSnowball classes, implementing get_class_types for each and adjusting Yeti/GhostTree for their changed base class.

tobbi commented 1 month ago

@Vankata453 Can you merge this, please?