================ 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. ================ */
| 3108 | ================ |
| 3109 | */ |
| 3110 | idThread *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 | ================ |
nothing calls this directly
no test coverage detected