Permalink
Browse files

Add deleted parameter for onResourceStop

  • Loading branch information...
Necktrox committed Feb 16, 2018
1 parent 244ab7f commit 98502947c6df8a45f6204f9feec3dcdce73e75ca
Showing with 6 additions and 3 deletions.
  1. +1 −1 Server/mods/deathmatch/logic/CGame.cpp
  2. +5 −2 Server/mods/deathmatch/logic/CResource.cpp
@@ -1454,7 +1454,7 @@ void CGame::AddBuiltInEvents ( void )
// Resource events
m_Events.AddEvent ( "onResourcePreStart", "resource", NULL, false );
m_Events.AddEvent ( "onResourceStart", "resource", NULL, false );
m_Events.AddEvent ( "onResourceStop", "resource", NULL, false );
m_Events.AddEvent ( "onResourceStop", "resource, deleted", NULL, false );
// Blip events
@@ -92,6 +92,7 @@ CResource::CResource ( CResourceManager * resourceManager, bool bIsZipped, const
m_bProtected = false;
m_bStartedManually = false;
m_iDownloadPriorityGroup = 0;
m_bDestroyed = false;
m_uiVersionMajor = 0;
m_uiVersionMinor = 0;
@@ -447,6 +448,9 @@ void CResource::Reload ( void )
CResource::~CResource ( )
{
CIdArray::PushUniqueId ( this, EIdClass::RESOURCE, m_uiScriptID );
m_bDestroyed = true;
Unload ();
// Overkill, but easiest way to stop crashes:
@@ -460,8 +464,6 @@ CResource::~CResource ( )
m_strResourceName = "";
m_bDestroyed = true;
pthread_mutex_destroy(&m_mutex);
}
@@ -1097,6 +1099,7 @@ bool CResource::Stop ( bool bStopManually )
// Call the onResourceStop event on this resource element
CLuaArguments Arguments;
Arguments.PushResource ( this );
Arguments.PushBoolean ( m_bDestroyed );
m_pResourceElement->CallEvent ( "onResourceStop", Arguments );
// Remove us from the resources we depend on (they might unload too first)

0 comments on commit 9850294

Please sign in to comment.