MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / DeconstructScriptObject

Method DeconstructScriptObject

neo/d3xp/Entity.cpp:3240–3259  ·  view source on GitHub ↗

================ idEntity::DeconstructScriptObject Called during idEntity::~idEntity. Calls the destructor on the script object. Can be overridden by subclasses when a thread doesn't need to be allocated. Not called during idGameLocal::MapShutdown. ================ */

Source from the content-addressed store, hash-verified

3238================
3239*/
3240void idEntity::DeconstructScriptObject( void ) {
3241 idThread *thread;
3242 const function_t *destructor;
3243
3244 // don't bother calling the script object's destructor on map shutdown
3245 if ( gameLocal.GameState() == GAMESTATE_SHUTDOWN ) {
3246 return;
3247 }
3248
3249 // call script object's destructor
3250 destructor = scriptObject.GetDestructor();
3251 if ( destructor ) {
3252 // start a thread that will run immediately and be destroyed
3253 thread = new idThread();
3254 thread->SetThreadName( name.c_str() );
3255 thread->CallFunction( this, destructor, true );
3256 thread->Execute();
3257 delete thread;
3258 }
3259}
3260
3261/*
3262================

Callers

nothing calls this directly

Calls 6

GameStateMethod · 0.45
GetDestructorMethod · 0.45
SetThreadNameMethod · 0.45
c_strMethod · 0.45
CallFunctionMethod · 0.45
ExecuteMethod · 0.45

Tested by

no test coverage detected