-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Index intermediate classes of GameObjects, try two #3009
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look through the list of all classes to see if all are accounted for, but code-wise this looks good.
This allows for much more efficient implementations of GameObjectManager's get_object_count and get_objects_by_type. Now, for example, counting all BadGuy objects does not require scanning through all the unrelated objects. Also, GameObjectIterator<T> can now be simplified, as it is only used on vectors which contain only objects with T as a base class.
I've updated this PR to account for the new Boss and BigSnowball classes, implementing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested this, but looks good, code-wise.
@Vankata453 Can you merge this, please? |
See #2991 for details; in short, this significantly speeds up
GameObjectManager::get_objects_by_type()
andGameObjectManager::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.