================ 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. ================ */
| 1776 | ================ |
| 1777 | */ |
| 1778 | void 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 | ================ |
nothing calls this directly
no test coverage detected