Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into marker
Browse files Browse the repository at this point in the history
Nico8340 authored Apr 4, 2024
2 parents 38f198b + aa932d2 commit 5e3ff5f
Showing 4 changed files with 1,947 additions and 1,893 deletions.
9 changes: 9 additions & 0 deletions Client/game_sa/CPoolsSA.cpp
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
#include "CWorldSA.h"
#include "CKeyGenSA.h"
#include "CFileLoaderSA.h"
#include "CPtrNodeSingleListSA.h"

extern CGameSA* pGame;

@@ -410,6 +411,14 @@ void CPoolsSA::RemoveBuilding(CBuilding* pBuilding)
// Remove building from world
pGame->GetWorld()->Remove(pInterface, CBuildingPool_Destructor);

// Remove building from cover list
CPtrNodeSingleListSAInterface<CBuildingSAInterface>* coverList = reinterpret_cast<CPtrNodeSingleListSAInterface<CBuildingSAInterface>*>(0xC1A2B8);
coverList->RemoveItem(pInterface);

// Remove plant
using CPlantColEntry_Remove = CEntitySAInterface* (*)(CEntitySAInterface*);
((CPlantColEntry_Remove)0x5DBEF0)(pInterface);

// Remove col reference
auto modelInfo = pGame->GetModelInfo(pBuilding->GetModelIndex());
modelInfo->RemoveColRef();
45 changes: 45 additions & 0 deletions Client/game_sa/CPtrNodeSingleListSA.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: game_sa/CPtrNodeSingleListSA.cpp
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
*
*****************************************************************************/

#pragma once

template <class T>
struct CPtrNodeSingleLink
{
T* pItem;
CPtrNodeSingleLink* pNext;
};

template <class T>
class CPtrNodeSingleListSAInterface
{
public:
void RemoveItem(T* item);
void RemoveAllItems();

private:
CPtrNodeSingleLink<T>* m_pList;
};

template <class T>
void CPtrNodeSingleListSAInterface<T>::RemoveItem(T* item)
{
using CPtrNodeSingleList_RemoveItem_t = void(__thiscall*)(CPtrNodeSingleListSAInterface<T> * pLinkList, void* item);
((CPtrNodeSingleList_RemoveItem_t)0x533610)(this, item);
}

template <class T>
void CPtrNodeSingleListSAInterface<T>::RemoveAllItems()
{
while (m_pList)
{
RemoveItem(m_pList->pItem);
}
}
2 changes: 2 additions & 0 deletions Client/mods/deathmatch/logic/CClientModel.cpp
Original file line number Diff line number Diff line change
@@ -109,6 +109,8 @@ void CClientModel::RestoreEntitiesUsingThisModel()
{
case eClientModelType::PED:
case eClientModelType::OBJECT:
case eClientModelType::CLUMP:
case eClientModelType::TIMED_OBJECT:
case eClientModelType::VEHICLE:
RestoreDFF(pModelInfo);
return;
3,784 changes: 1,891 additions & 1,893 deletions Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot

Large diffs are not rendered by default.

0 comments on commit 5e3ff5f

Please sign in to comment.