Game Development Community

DeleteObject() not called on ghosts if deleted via disconnecting

by Orion Elenzil · in Torque Game Engine · 01/14/2008 (5:35 pm) · 1 replies

In our TGE1.3.5-based codebase,
SimObject::deleteObject() is not called on client-side instances of SimObjects such as players when the client disconnects from the server.

this is important in our app because we've added an onDelete() script callback which expects to be called when the object is deleted.

the cause seems to be that during disconnect, the objects are deleted in SimGroup's destructor:
SimGroup::~SimGroup()
{
   for (iterator itr = begin(); itr != end(); itr++)
      nameDictionary.remove(*itr);

   // XXX Move this later into Group Class
   // If we have any objects at this point, they should 
   // already have been removed from the manager, so we
   // can just delete them directly.
   objectList.sortId();
   while (!objectList.empty()) {
      delete objectList.last();
      objectList.decrement();
   }
}

is there a reason not to change that delete call to "objectList.last()->deleteObject()" ?

#1
01/14/2008 (6:54 pm)
Hm, by the time ~SimGroup() is called,
the children have already been unregistered w/ the sim, so a script callback then is out of the question.