addProtectedField clarification
by elvince · in Torque 3D Professional · 02/23/2011 (12:23 am) · 1 replies
Hi,
I just need a clarification on addProtectedField.
my understanding:
When a variable is set, it will call the set function. If it return true, then the value is set, if false, it's not set.
Pretty straight forward :D
In gamebase:
in the set function you can find:
if( Sim::findObject( db, data ) )
return object->setDataBlock( data );
So if the setDatablock return true, the variable is updated twice. One time in setDatablock and once when return true.
Did I miss something?
I did make a test on my own class, and if you return true, the datablock variable is set correctly. So what is the use of setting it twice? may be some old code... but I think it worse to be clear ^^
I just need a clarification on addProtectedField.
my understanding:
When a variable is set, it will call the set function. If it return true, then the value is set, if false, it's not set.
Pretty straight forward :D
In gamebase:
in the set function you can find:
if( Sim::findObject( db, data ) )
return object->setDataBlock( data );
So if the setDatablock return true, the variable is updated twice. One time in setDatablock and once when return true.
Did I miss something?
I did make a test on my own class, and if you return true, the datablock variable is set correctly. So what is the use of setting it twice? may be some old code... but I think it worse to be clear ^^
About the author
Torque Owner Daniel Buckmaster
T3D Steering Committee