Datablock names and object names: conflict?
by Mathieu Marquis-Bolduc · in Torque Game Engine · 02/10/2007 (11:56 am) · 5 replies
Strange thing that occured to me, and I am not sure if it is a bug or it is like that by design.
I have an item datablock, lets call it smurf:
datablock ItemData(smurf)
{
//stuff
}
And I also have in a particular mission, a SimObject which name is also "smurf", totally unrelated to the above datablock.
The mission launch correctly. However, when I try to create an object from the datablock "smurf", I get the following error:
"smurf" is not a member of "GameBaseData" datablock class.
If I change the name of the SimObject to anything else, it works correctly.
Is this a bug in the SDK (1.4 here), or does it means that an object should never have the same name as a datablock? Should warn your game designer about this, so that they choose their names carefully :)
Thanks for any pointers on this.
I have an item datablock, lets call it smurf:
datablock ItemData(smurf)
{
//stuff
}
And I also have in a particular mission, a SimObject which name is also "smurf", totally unrelated to the above datablock.
The mission launch correctly. However, when I try to create an object from the datablock "smurf", I get the following error:
"smurf" is not a member of "GameBaseData" datablock class.
If I change the name of the SimObject to anything else, it works correctly.
Is this a bug in the SDK (1.4 here), or does it means that an object should never have the same name as a datablock? Should warn your game designer about this, so that they choose their names carefully :)
Thanks for any pointers on this.
#2
02/10/2007 (12:08 pm)
So a datablock is also a SimObject?
#3
BTW, a good project that is kind of fun is to create a simobject that you can spawn (new) and kill (delete). It gives you a sense of power. Muahahaha!!!
Seriously though, just look at those files if you are interested. They are in "engine/console" in the Torque directory.
02/10/2007 (8:17 pm)
Go to simBase.h and simBase.cc. The root of all sim objects. Datablocks are defined in there I believe.BTW, a good project that is kind of fun is to create a simobject that you can spawn (new) and kill (delete). It gives you a sense of power. Muahahaha!!!
Seriously though, just look at those files if you are interested. They are in "engine/console" in the Torque directory.
#4
02/10/2007 (9:42 pm)
Yes...all objects in Torque that have SimID's and possibly names are SimObjects.
#5
Hum.... it would be interesting to make a small patch that send out a warning to the console if duplicated names are found. I'll keep that for a rainy day.
02/11/2007 (7:32 am)
Allright, thanks for the help guys!Hum.... it would be interesting to make a small patch that send out a warning to the console if duplicated names are found. I'll keep that for a rainy day.
Torque 3D Owner Stephen Zepp