Skip to content

Commit 791dd0c

Browse files
committed
Allow onClientElementDestroy events (reviews)
1 parent acaab7a commit 791dd0c

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

Client/mods/deathmatch/logic/CClientRenderElementManager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ CClientTexture* CClientRenderElementManager::FindAutoTexture(const SString& strF
295295
if (!pNewTextureElement)
296296
return nullptr;
297297

298+
pNewTextureElement->MakeSystemEntity();
299+
298300
// Add to automap if created
299301
MapSet(m_AutoTextureMap, strUniqueName, SAutoTexture{pNewTextureElement});
300302
ppTextureElement = MapFind(m_AutoTextureMap, strUniqueName);
@@ -390,5 +392,5 @@ void CClientRenderElementManager::DoPulse()
390392
}
391393

392394
for (CClientTexture* texture : deleteCandidates)
393-
g_pClientGame->GetElementDeleter()->Delete(texture, true);
395+
g_pClientGame->GetElementDeleter()->Delete(texture);
394396
}

Client/mods/deathmatch/logic/CElementDeleter.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@ CElementDeleter::CElementDeleter()
1919
m_bAllowUnreference = true;
2020
}
2121

22-
void CElementDeleter::Delete(class CClientEntity* pElement, bool silent)
22+
void CElementDeleter::Delete(class CClientEntity* pElement)
2323
{
2424
// Make sure we don't try to delete it twice
2525
if (pElement && !IsBeingDeleted(pElement))
2626
{
2727
// Before we do anything, fire the on-destroy event
28-
if (!silent)
29-
{
30-
CLuaArguments Arguments;
31-
pElement->CallEvent("onClientElementDestroy", Arguments, true);
32-
}
28+
CLuaArguments Arguments;
29+
pElement->CallEvent("onClientElementDestroy", Arguments, true);
3330

3431
// Add it to our list
3532
if (!pElement->IsBeingDeleted())

Client/mods/deathmatch/logic/CElementDeleter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CElementDeleter
2020
CElementDeleter();
2121
~CElementDeleter() { DoDeleteAll(); };
2222

23-
void Delete(class CClientEntity* pElement, bool silent = false);
23+
void Delete(class CClientEntity* pElement);
2424
void DeleteRecursive(class CClientEntity* pElement);
2525
void DoDeleteAll();
2626
bool IsBeingDeleted(class CClientEntity* pElement);

0 commit comments

Comments
 (0)