Game Development Community

Incorrect invalid SimObjectId used

by Michael Bacon · in Torque Game Engine · 10/24/2007 (4:00 am) · 0 replies

Some console methods and other aspects of the engine improperly use -1 as the value for an invalid Sim Object ID.

-1 is the ID of the RootGroup as defined in SimBase.h
0 is a standard invalid object ID as defined by isObject console function in SimBase.cc

It is important to note that Ghost Indexes use -1 as an invalid ID (shouldn't this be consolidated?).


I apologize if this has been discussed already.


So far I've only found a few references in the source code that return incorrect values.

The following console methods return -1 for invalid values:

nameToID
SimSet.getObject
WorldEditor.getSelectedObject
Trigger.getObject
GameConnection.getServerConnection (while -1 is obviously not a valid connection it is a valid object id)

And finally I'm not sure if the gui stuff should be using a -1 for an invalid id for things but I don't see how it can hurt and I don't want to change it.