mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-02 02:51:00 +00:00
Merge pull request #1451 from Azaezel/alpha41/cleanerCleanups
isobject and obj.delete safties
This commit is contained in:
commit
b095134df8
|
|
@ -102,7 +102,15 @@ DefineEngineFunction( isObject, bool, (const char * objectName), ,"isObject(obje
|
|||
if (!String::compare(objectName, "0") || !String::compare(objectName, ""))
|
||||
return false;
|
||||
else
|
||||
return (Sim::findObject(objectName) != NULL);
|
||||
{
|
||||
SimObject* obj= Sim::findObject(objectName);
|
||||
if (obj)
|
||||
{
|
||||
if (!obj->isProperlyAdded() || obj->isRemoved())
|
||||
obj = NULL;
|
||||
}
|
||||
return obj != NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ConsoleDocFragment _spawnObject1(
|
||||
|
|
|
|||
|
|
@ -3296,6 +3296,9 @@ DefineEngineMethod( SimObject, getGroup, SimGroup*, (),,
|
|||
DefineEngineMethod( SimObject, delete, void, (),,
|
||||
"Delete and remove the object." )
|
||||
{
|
||||
if (!object->isProperlyAdded() || object->isRemoved())
|
||||
return;
|
||||
|
||||
object->deleteObject();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue