SimGroup deletion *FIX*
by Bryan Edds · in Torque Game Builder · 03/27/2005 (10:40 am) · 6 replies
Sorry for the cross-posting... couldn't figure a better way to get the word out for this critical fix -
www.garagegames.com/mg/forums/result.thread.php?qt=28030
www.garagegames.com/mg/forums/result.thread.php?qt=28030
#2
03/27/2005 (1:22 pm)
Here ya go:/// the normal implementation of SimGroup does not call the script ::delete()
/// on the members it deletes, so that is fixed here.
package SimGroupFix{
function SimGroup::delete(%this)
{
%count = %this.getCount();
for(%i = %count - 1; %i > -1; %i--)
{
%obj = %this.getObject(%i);
if(isObject(%obj)) %obj.delete();
}
Parent::delete(%this);
}
}; activatePackage(SimGroupFix);
#3
03/27/2005 (4:31 pm)
Oops, that was pretty dumb on my part!
#4
03/27/2005 (6:45 pm)
I believe the current functionality is by design. You can use the ScriptObject::onAdd and ScriptObject::onRemove callbacks as your constructor and deconstructor for ScriptObject classes.
#5
You might be right, but I have to think about it before I can confirm that.
03/27/2005 (7:59 pm)
That 's what I thought initially, but then I changed my mind for some reason... I'm still really not sure why :)You might be right, but I have to think about it before I can confirm that.
#6
It looks like Nool is right - this is unecessary and delete shouldn't be overriden to accomplish destruction.
Please ignore this thread, and do not do the recommend change.
03/27/2005 (10:17 pm)
ATTENTION IMPORTANTIt looks like Nool is right - this is unecessary and delete shouldn't be overriden to accomplish destruction.
Please ignore this thread, and do not do the recommend change.
Torque Owner Greg Lincoln