CObjectSA::~CObjectSA( ) { DEBUG_TRACE("CObjectSA::~CObjectSA( )"); //OutputDebugString("Attempting to destroy Object\n"); if(!this->BeingDeleted && DoNotRemoveFromGame == false) { DWORD dwInterface = (DWORD)this->GetInterface(); if ( dwInterface ) { CWorldSA * world = (CWorldSA *)pGame->GetWorld(); world->Remove(this->GetInterface()); DWORD dwThis = (DWORD)this->GetInterface(); DWORD dwFunc = this->GetInterface()->vtbl->Remove; _asm { mov ecx, dwThis call dwFunc } dwFunc = this->GetInterface()->vtbl->SCALAR_DELETING_DESTRUCTOR; // we use the vtbl so we can be type independent _asm { mov ecx, dwThis push 1 //delete too call dwFunc } #ifdef MTA_USE_BUILDINGS_AS_OBJECTS DWORD dwModelID = this->internalInterface->m_nModelIndex; // REMOVE ref to colstore thingy dwFunc = 0x4107D0; _asm { mov eax, dwModelID mov eax, 0xA9B0C8[eax*4] mov eax, [eax+20] movzx eax, byte ptr [eax+40] push eax call dwFunc add esp, 4 } #endif } this->BeingDeleted = true; ((CPoolsSA *)pGame->GetPools())->RemoveObject((CObject *)(CObjectSA *)this); //OutputDebugString("Destroying Object\n"); }
CEntitySA::~CEntitySA() { // Unlink disabled-collisions while ( !m_disabledColl.empty() ) SetCollidableWith( pGame->GetPools()->GetEntity( m_disabledColl.begin()->first ), true ); if ( m_doNotRemoveFromGame ) return; CWorldSA *world = pGame->GetWorld(); world->Remove( m_pInterface ); world->RemoveReferencesToDeletedObject( m_pInterface ); // Clever little trick, eh delete m_pInterface; }
CCivilianPedSA::~CCivilianPedSA( ) { DEBUG_TRACE("CCivilianPedSA::~CCivilianPedSA( )"); if(!this->BeingDeleted && DoNotRemoveFromGame == false) { DWORD dwInterface = (DWORD)this->GetInterface(); if ( (DWORD)this->GetInterface()->vtbl != VTBL_CPlaceable ) { CWorldSA * world = (CWorldSA *)pGame->GetWorld(); world->Remove(this->GetInterface(), CCivPed_Destructor); DWORD dwThis = (DWORD)this->GetInterface(); DWORD dwFunc = this->GetInterface()->vtbl->SCALAR_DELETING_DESTRUCTOR; // we use the vtbl so we can be type independent _asm { mov ecx, dwThis push 1 //delete too call dwFunc } }
CBuildingSA::~CBuildingSA( ) { DEBUG_TRACE("CBuildingSA::~CBuildingSA( )"); if(!this->BeingDeleted && DoNotRemoveFromGame == false) { DWORD dwInterface = (DWORD)this->GetInterface(); CWorldSA * world = (CWorldSA *)pGame->GetWorld(); world->Remove(this->GetInterface()); DWORD dwThis = (DWORD)this->GetInterface(); DWORD dwFunc = this->GetInterface()->vtbl->SCALAR_DELETING_DESTRUCTOR; // we use the vtbl so we can be type independent _asm { mov ecx, dwThis push 1 //delete too call dwFunc } this->BeingDeleted = true; //((CPoolsSA *)pGame->GetPools())->RemoveBuilding((CBuilding *)(CBuildingSA *)this); } }