All pastes #252994 Raw Edit

Something

public text v1 · immutable
#252994 ·published 2006-11-20 05:04 UTC
rendered paste body
Hey Ed,

a Hash table could be an interesting way to do name lookups, and worth researching...

one way to speed up object operations is to have a way to know if an object is in the current scene or not
getting the base for an object also takes a fair ammount of time,

I think is to make objects link back to their last used scene and base-
so an object would have  a Base* and a Scene* added to the struct,

Heres how it would work
* on initializing or changing a scenes, ob->scene and ob->base would be set to that scene, and its base in that scnen.
* when removing an object from the current scene ob->scene and ob->base would be set to NULL

So you could always know, without a loop
* is the object in the current scene
* the object base in the active scene (if above is true)

At worst, you wont know weather the object is in a scene other then the active scene, but thats only if the object is in more then 1 scene at a time.
in that case youd still need to to a full loop but In my experience, objects used in multiple scenes is useually limited to a smaller number and most lookups deal with the active scenes.