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

Method DeconstructScriptObject

neo/game/Weapon.cpp:1778–1803  ·  view source on GitHub ↗

================ idWeapon::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

1776================
1777*/
1778void idWeapon::DeconstructScriptObject( void ) {
1779 const function_t *destructor;
1780
1781 if ( !thread ) {
1782 return;
1783 }
1784
1785 // don't bother calling the script object's destructor on map shutdown
1786 if ( gameLocal.GameState() == GAMESTATE_SHUTDOWN ) {
1787 return;
1788 }
1789
1790 thread->EndThread();
1791
1792 // call script object's destructor
1793 destructor = scriptObject.GetDestructor();
1794 if ( destructor ) {
1795 // start a thread that will run immediately and end
1796 thread->CallFunction( this, destructor, true );
1797 thread->Execute();
1798 thread->EndThread();
1799 }
1800
1801 // clear out the object's memory
1802 scriptObject.ClearObject();
1803}
1804
1805/*
1806================

Callers

nothing calls this directly

Calls 6

GameStateMethod · 0.45
EndThreadMethod · 0.45
GetDestructorMethod · 0.45
CallFunctionMethod · 0.45
ExecuteMethod · 0.45
ClearObjectMethod · 0.45

Tested by

no test coverage detected