Game Development Community

Whats up with ObjectTypes?

by Henry Shilling · in Torque X 2D · 02/23/2010 (12:56 pm) · 0 replies

When trying to filter a list by object type I ran into some really strange stuff. Since I cannot find objects based on ObjectType I run the list like this:

List<T2DSceneObject> _items = TorqueObjectDatabase.Instance.FindRegisteredObjects<T2DSceneObject>();

Then get the object type I am looking for:

TorqueObjectType enemy = TorqueObjectDatabase.Instance.GetObjectType("nme");

The object type "nme" comes out looking like this:
_bits      8
_typeName  "nme"
Bits       8
IsMultiple false
Name       "nme"
Valid      true

in the list the ObjectType looks like this:
_bits      1033
_typeName  "unknown"
Bits       1033
IsMultiple false
Name       "unknown"
Valid      true

Ok wierd, where are those extra bits coming from? It makes it pretty hard to do a sort and pull out the objects I want. I tried doing a bitwise and:

if ((_items[i].ObjectType.Bits & enemy.Bits) != 0)
    mylist.add(_items[i]);

I get some things that do not belong. What exactly am I doing wrong or does anyone know whats going on here?

It's really strange but the objects have the extra bits before they are cloned, so it's like something weird is happening on scene load.