diff --git a/saco/game/entity.cpp b/saco/game/entity.cpp index aa86d0b..5a084a1 100644 --- a/saco/game/entity.cpp +++ b/saco/game/entity.cpp @@ -1,7 +1,15 @@ +#include +#include +#include + #include "../main.h" +#include "util.h" #include "entity.h" +extern CGame *pGame; +extern CNetGame *pNetGame; +extern CChatWindow *pChatWindow; //----------------------------------------------------------- @@ -299,3 +307,28 @@ BOOL CEntity::IsAdded() //----------------------------------------------------------- +void CEntity::Remove() +{ + // Check for CPlaceable messup + if(!m_pEntity || m_pEntity->vtable == 0x863C40) + { +#ifdef _DEBUG + OutputDebugString("CEntity::Remove - m_pEntity == NULL or CPlaceable"); +#endif + return; + } + + if(m_pEntity->dwUnkModelRel) { + WorldRemoveEntity((PDWORD)m_pEntity); + +#ifdef _DEBUG + if (IsAdded()) + { + OutputDebugString("CEntity::Remove failed..."); + } +#endif + } +} + +//----------------------------------------------------------- + diff --git a/saco/game/entity.h b/saco/game/entity.h index 3dbf3c7..f2e248a 100644 --- a/saco/game/entity.h +++ b/saco/game/entity.h @@ -32,6 +32,7 @@ public: BOOL FUNC_1009FDE0(); virtual void Add(); + virtual void Remove(); BOOL IsAdded(); VECTOR field_4[5];