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

Method ConstructScriptObject

neo/game/Entity.cpp:3110–3133  ·  view source on GitHub ↗

================ idEntity::ConstructScriptObject Called during idEntity::Spawn. Calls the constructor on the script object. Can be overridden by subclasses when a thread doesn't need to be allocated. ================ */

Source from the content-addressed store, hash-verified

3108================
3109*/
3110idThread *idEntity::ConstructScriptObject( void ) {
3111 idThread *thread;
3112 const function_t *constructor;
3113
3114 // init the script object's data
3115 scriptObject.ClearObject();
3116
3117 // call script object's constructor
3118 constructor = scriptObject.GetConstructor();
3119 if ( constructor ) {
3120 // start a thread that will initialize after Spawn is done being called
3121 thread = new idThread();
3122 thread->SetThreadName( name.c_str() );
3123 thread->CallFunction( this, constructor, true );
3124 thread->DelayedStart( 0 );
3125 } else {
3126 thread = NULL;
3127 }
3128
3129 // clear out the object's memory
3130 scriptObject.ClearObject();
3131
3132 return thread;
3133}
3134
3135/*
3136================

Callers

nothing calls this directly

Calls 6

ClearObjectMethod · 0.45
GetConstructorMethod · 0.45
SetThreadNameMethod · 0.45
c_strMethod · 0.45
CallFunctionMethod · 0.45
DelayedStartMethod · 0.45

Tested by

no test coverage detected