Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization Handling (part 3) and Remove big use eVehicleTypes #3848

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
394df3a
Update
Moris-Onz Nov 8, 2024
b84fa60
Update 2
Moris-Onz Nov 8, 2024
6e8565e
Update 3
Moris-Onz Nov 8, 2024
203fb7c
Fix by TracerDS 1
Moris-Onz Nov 8, 2024
8ca57f0
Update 4
Moris-Onz Nov 9, 2024
1e6992d
Update 4 (mini fix)
Moris-Onz Nov 9, 2024
9610dbc
Fix crash
Moris-Onz Nov 9, 2024
b066bc3
Refactor AddVehicle and AddTrain
Moris-Onz Nov 10, 2024
e5113de
Update 5
Moris-Onz Nov 10, 2024
ffd2ba7
Update 5 (Fix)
Moris-Onz Nov 10, 2024
434457a
Update 6
Moris-Onz Nov 10, 2024
bea11d6
std::shared_ptr from CHandlingManagerSA
Moris-Onz Nov 10, 2024
96a3cc4
std::shared_ptr for CPoolsSA (Test)
Moris-Onz Nov 10, 2024
0f6246e
Revert "std::shared_ptr for CPoolsSA (Test)"
Moris-Onz Nov 10, 2024
3d0b407
std::unique_ptr for CPoolsSA
Moris-Onz Nov 10, 2024
f901042
Update 7
Moris-Onz Nov 11, 2024
bd79171
Add CModelInfoSA::IsVehicleModel
Moris-Onz Nov 11, 2024
0462828
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 12, 2024
4888066
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 15, 2024
1e87d4a
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 16, 2024
e3b6707
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 20, 2024
77efe2d
Merge branch 'master' into clean-eVehicleTypes
Dutchman101 Nov 21, 2024
55098d6
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 21, 2024
fcc2c93
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 22, 2024
8641aba
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 27, 2024
d46c9df
Merge branch 'master' into clean-eVehicleTypes
G-Moris Nov 29, 2024
47068d4
Fixes by TheNormalnij
Moris-Onz Nov 29, 2024
b0cddf5
Merge branch 'clean-eVehicleTypes' of https://github.com/G-Moris/mtas…
Moris-Onz Nov 29, 2024
0486d25
Fix style
Moris-Onz Nov 29, 2024
ece4318
Merge branch 'master' into clean-eVehicleTypes
G-Moris Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Client/game_sa/CCamSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ CEntity* CCamSA::GetTargetEntity() const
CEntitySAInterface* pInterface = m_pInterface->CamTargetEntity;
if (pInterface)
{
CPools* pPools = pGame->GetPools();
return pPools->GetEntity((DWORD*)pInterface);
auto pools = pGame->GetPools();
return pools->GetEntity((DWORD*)pInterface);
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
}
return nullptr;
}
Expand Down
3 changes: 1 addition & 2 deletions Client/game_sa/CCameraSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ CEntity* CCameraSA::GetTargetEntity()
CEntitySAInterface* pInterface = GetInterface()->pTargetEntity;
if (pInterface)
{
CPools* pPools = pGame->GetPools();
return pPools->GetEntity((DWORD*)pInterface);
return pGame->GetPools()->GetEntity((DWORD*)pInterface);
}
return nullptr;
}
Expand Down
3 changes: 1 addition & 2 deletions Client/game_sa/CEventDamageSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ CEntity* CEventDamageSA::GetInflictingEntity()
CEntitySAInterface* pInterface = m_pInterface->pInflictor;
if (pInterface)
{
CPools* pPools = pGame->GetPools();
return pPools->GetEntity((DWORD*)pInterface);
return pGame->GetPools()->GetEntity((DWORD*)pInterface);
}
return pReturn;
}
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/CExplosionSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CEntity* CExplosionSA::GetExplosionCreator()
{
eEntityType entityType = (eEntityType)GetInterface()->m_pEntExplosionOwner->nType;

CPools* pools = pGame->GetPools();
auto pools = pGame->GetPools();
switch (entityType)
{
case ENTITY_TYPE_PED:
Expand Down
16 changes: 8 additions & 8 deletions Client/game_sa/CFireSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ CEntity* CFireSA::GetCreator()
{
CEntity* creatorEntity = NULL;
CEntitySAInterface* createEntitySA = internalInterface->entityCreator;
CPoolsSA* pPools = ((CPoolsSA*)pGame->GetPools());
if (pPools && createEntitySA)
auto pools = std::static_pointer_cast<CPoolsSA>(pGame->GetPools());
if (pools && createEntitySA)
{
switch (createEntitySA->nType)
{
case ENTITY_TYPE_PED:
{
SClientEntity<CPedSA>* pPedClientEntity = pPools->GetPed((DWORD*)createEntitySA);
SClientEntity<CPedSA>* pPedClientEntity = pools->GetPed((DWORD*)createEntitySA);
if (pPedClientEntity)
{
creatorEntity = pPedClientEntity->pEntity;
Expand All @@ -86,7 +86,7 @@ CEntity* CFireSA::GetCreator()
}
case ENTITY_TYPE_VEHICLE:
{
SClientEntity<CVehicleSA>* pVehicleClientEntity = pPools->GetVehicle((DWORD*)createEntitySA);
SClientEntity<CVehicleSA>* pVehicleClientEntity = pools->GetVehicle((DWORD*)createEntitySA);
if (pVehicleClientEntity)
{
creatorEntity = pVehicleClientEntity->pEntity;
Expand All @@ -106,14 +106,14 @@ CEntity* CFireSA::GetEntityOnFire()
{
CEntity* TargetEntity = NULL;
CEntitySAInterface* TargetEntitySA = internalInterface->entityTarget;
CPoolsSA* pPools = ((CPoolsSA*)pGame->GetPools());
if (pPools && TargetEntitySA)
auto pools = std::static_pointer_cast<CPoolsSA>(pGame->GetPools());
if (pools && TargetEntitySA)
{
switch (TargetEntitySA->nType)
{
case ENTITY_TYPE_PED:
{
SClientEntity<CPedSA>* pPedClientEntity = pPools->GetPed((DWORD*)TargetEntitySA);
SClientEntity<CPedSA>* pPedClientEntity = pools->GetPed((DWORD*)TargetEntitySA);
if (pPedClientEntity)
{
TargetEntity = pPedClientEntity->pEntity;
Expand All @@ -122,7 +122,7 @@ CEntity* CFireSA::GetEntityOnFire()
}
case ENTITY_TYPE_VEHICLE:
{
SClientEntity<CVehicleSA>* pVehicleClientEntity = pPools->GetVehicle((DWORD*)TargetEntitySA);
SClientEntity<CVehicleSA>* pVehicleClientEntity = pools->GetVehicle((DWORD*)TargetEntitySA);
if (pVehicleClientEntity)
{
TargetEntity = pVehicleClientEntity->pEntity;
Expand Down
41 changes: 20 additions & 21 deletions Client/game_sa/CGameSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ CGameSA::CGameSA()
m_pAESoundManager = new CAESoundManagerSA((CAESoundManagerSAInterface*)CLASS_CAESoundManager);
m_pAudioContainer = new CAudioContainerSA();
m_pWorld = new CWorldSA();
m_pPools = new CPoolsSA();
m_Pools = std::make_shared<CPoolsSA>();
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
m_pClock = new CClockSA();
m_pRadar = new CRadarSA();
m_pCamera = new CCameraSA((CCameraSAInterface*)CLASS_CCamera);
Expand Down Expand Up @@ -208,17 +208,17 @@ CGameSA::CGameSA()
m_Cheats[CHEAT_HEALTARMORMONEY] = new SCheatSA((BYTE*)VAR_HealthArmorMoney, false);

// Change pool sizes here
m_pPools->SetPoolCapacity(TASK_POOL, 5000); // Default is 500
m_pPools->SetPoolCapacity(OBJECT_POOL, MAX_OBJECTS); // Default is 350
m_pPools->SetPoolCapacity(EVENT_POOL, 5000); // Default is 200
m_pPools->SetPoolCapacity(COL_MODEL_POOL, 12000); // Default is 10150
m_pPools->SetPoolCapacity(ENV_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_pPools->SetPoolCapacity(ENV_MAP_ATOMIC_POOL, 4000); // Default is 1024
m_pPools->SetPoolCapacity(SPEC_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_pPools->SetPoolCapacity(ENTRY_INFO_NODE_POOL, MAX_ENTRY_INFO_NODES); // Default is 500
m_pPools->SetPoolCapacity(POINTER_SINGLE_LINK_POOL, MAX_POINTER_SINGLE_LINKS); // Default is 70000
m_pPools->SetPoolCapacity(POINTER_DOUBLE_LINK_POOL, MAX_POINTER_DOUBLE_LINKS); // Default is 3200
dassert(m_pPools->GetPoolCapacity(POINTER_SINGLE_LINK_POOL) == MAX_POINTER_SINGLE_LINKS);
m_Pools->SetPoolCapacity(TASK_POOL, 5000); // Default is 500
m_Pools->SetPoolCapacity(OBJECT_POOL, MAX_OBJECTS); // Default is 350
m_Pools->SetPoolCapacity(EVENT_POOL, 5000); // Default is 200
m_Pools->SetPoolCapacity(COL_MODEL_POOL, 12000); // Default is 10150
m_Pools->SetPoolCapacity(ENV_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_Pools->SetPoolCapacity(ENV_MAP_ATOMIC_POOL, 4000); // Default is 1024
m_Pools->SetPoolCapacity(SPEC_MAP_MATERIAL_POOL, 16000); // Default is 4096
m_Pools->SetPoolCapacity(ENTRY_INFO_NODE_POOL, MAX_ENTRY_INFO_NODES); // Default is 500
m_Pools->SetPoolCapacity(POINTER_SINGLE_LINK_POOL, MAX_POINTER_SINGLE_LINKS); // Default is 70000
m_Pools->SetPoolCapacity(POINTER_DOUBLE_LINK_POOL, MAX_POINTER_DOUBLE_LINKS); // Default is 3200
dassert(m_Pools->GetPoolCapacity(POINTER_SINGLE_LINK_POOL) == MAX_POINTER_SINGLE_LINKS);

// Increase streaming object instances list size
MemPut<WORD>(0x05B8E55, MAX_RWOBJECT_INSTANCES * 12); // Default is 1000 * 12
Expand Down Expand Up @@ -275,7 +275,6 @@ CGameSA::~CGameSA()
delete reinterpret_cast<CCameraSA*>(m_pCamera);
delete reinterpret_cast<CRadarSA*>(m_pRadar);
delete reinterpret_cast<CClockSA*>(m_pClock);
delete reinterpret_cast<CPoolsSA*>(m_pPools);
delete reinterpret_cast<CWorldSA*>(m_pWorld);
delete reinterpret_cast<CAudioEngineSA*>(m_pAudioEngine);
delete reinterpret_cast<CAEAudioHardwareSA*>(m_pAEAudioHardware);
Expand Down Expand Up @@ -369,11 +368,11 @@ eSystemState CGameSA::GetSystemState()
*/
bool CGameSA::InitLocalPlayer(CClientPed* pClientPed)
{
CPoolsSA* pools = (CPoolsSA*)GetPools();
auto pools = std::static_pointer_cast<CPoolsSA>(GetPools());
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
if (pools)
{
//* HACKED IN HERE FOR NOW *//
CPedSAInterface* pInterface = pools->GetPedInterface((DWORD)1);
CPedSAInterface* pInterface = pools->GetPedInterface(1UL);

if (pInterface)
{
Expand Down Expand Up @@ -1010,8 +1009,8 @@ void CGameSA::RemoveAllBuildings()
{
m_pIplStore->SetDynamicIplStreamingEnabled(false);

m_pPools->GetDummyPool().RemoveAllBuildingLods();
m_pPools->GetBuildingsPool().RemoveAllBuildings();
m_Pools->GetDummyPool().RemoveAllBuildingLods();
m_Pools->GetBuildingsPool().RemoveAllBuildings();

auto pBuildingRemoval = static_cast<CBuildingRemovalSA*>(m_pBuildingRemoval);
pBuildingRemoval->DropCaches();
Expand All @@ -1021,8 +1020,8 @@ void CGameSA::RemoveAllBuildings()

void CGameSA::RestoreGameBuildings()
{
m_pPools->GetBuildingsPool().RestoreAllBuildings();
m_pPools->GetDummyPool().RestoreAllBuildingsLods();
m_Pools->GetBuildingsPool().RestoreAllBuildings();
m_Pools->GetDummyPool().RestoreAllBuildingsLods();

m_pIplStore->SetDynamicIplStreamingEnabled(true, [](CIplSAInterface* ipl) { return memcmp("barriers", ipl->name, 8) != 0; });
m_isBuildingsRemoved = false;
Expand All @@ -1040,7 +1039,7 @@ bool CGameSA::SetBuildingPoolSize(size_t size)
static_cast<CBuildingRemovalSA*>(m_pBuildingRemoval)->DropCaches();
}

bool status = m_pPools->GetBuildingsPool().Resize(size);
bool status = m_Pools->GetBuildingsPool().Resize(size);

if (shouldRemoveBuilding)
{
Expand Down Expand Up @@ -1096,7 +1095,7 @@ void CGameSA::OnPedContextChange(CPed* pPedContext)
CPed* CGameSA::GetPedContext()
{
if (!m_pPedContext)
m_pPedContext = pGame->GetPools()->GetPedFromRef((DWORD)1);
m_pPedContext = pGame->GetPools()->GetPedFromRef(1UL);
return m_pPedContext;
}

Expand Down
4 changes: 2 additions & 2 deletions Client/game_sa/CGameSA.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class CGameSA : public CGame
CGameSA();
~CGameSA();

CPools* GetPools() { return m_pPools; }
std::shared_ptr<CPools> GetPools() const noexcept { return m_Pools; }
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
CPlayerInfo* GetPlayerInfo() { return m_pPlayerInfo; }
CProjectileInfo* GetProjectileInfo() { return m_pProjectileInfo; }
CRadar* GetRadar() { return m_pRadar; }
Expand Down Expand Up @@ -311,7 +311,7 @@ class CGameSA : public CGame
bool SetBuildingPoolSize(size_t size);

private:
CPools* m_pPools;
std::shared_ptr<CPools> m_Pools;
G-Moris marked this conversation as resolved.
Show resolved Hide resolved
CPlayerInfo* m_pPlayerInfo;
CProjectileInfo* m_pProjectileInfo;
CRadar* m_pRadar;
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/CObjectSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ CObjectSA::~CObjectSA()
}

BeingDeleted = true;
((CPoolsSA*)pGame->GetPools())->RemoveObject((CObject*)(CObjectSA*)this);
pGame->GetPools()->RemoveObject((CObject*)(CObjectSA*)this);
}
}

Expand Down
9 changes: 4 additions & 5 deletions Client/game_sa/CPedSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,12 @@ CEntity* CPedSA::GetContactEntity()
CEntitySAInterface* pInterface = ((CPedSAInterface*)GetInterface())->pContactEntity;
if (pInterface)
{
CPools* pPools = pGame->GetPools();
auto pools = pGame->GetPools();
switch (pInterface->nType)
{
case ENTITY_TYPE_VEHICLE:
{
SClientEntity<CVehicleSA>* pVehicleClientEntity = pPools->GetVehicle((DWORD*)pInterface);
SClientEntity<CVehicleSA>* pVehicleClientEntity = pools->GetVehicle((DWORD*)pInterface);
if (pVehicleClientEntity)
{
return pVehicleClientEntity->pEntity;
Expand All @@ -732,7 +732,7 @@ CEntity* CPedSA::GetContactEntity()
}
case ENTITY_TYPE_OBJECT:
{
SClientEntity<CObjectSA>* pObjectClientEntity = pPools->GetObject((DWORD*)pInterface);
SClientEntity<CObjectSA>* pObjectClientEntity = pools->GetObject((DWORD*)pInterface);
if (pObjectClientEntity)
{
return pObjectClientEntity->pEntity;
Expand All @@ -758,8 +758,7 @@ CEntity* CPedSA::GetTargetedEntity()
CEntitySAInterface* pInterface = ((CPedSAInterface*)GetInterface())->pTargetedEntity;
if (pInterface)
{
CPools* pPools = pGame->GetPools();
return pPools->GetEntity((DWORD*)pInterface);
return pGame->GetPools()->GetEntity((DWORD*)pInterface);
}
return nullptr;
}
Expand Down
6 changes: 2 additions & 4 deletions Client/game_sa/CPhysicalSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,7 @@ CEntity* CPhysicalSA::GetDamageEntity()
CEntitySAInterface* pInterface = ((CPhysicalSAInterface*)GetInterface())->m_pCollidedEntity;
if (pInterface)
{
CPools* pPools = pGame->GetPools();
return pPools->GetEntity((DWORD*)pInterface);
return pGame->GetPools()->GetEntity((DWORD*)pInterface);
}
return nullptr;
}
Expand All @@ -261,8 +260,7 @@ CEntity* CPhysicalSA::GetAttachedEntity()
CEntitySAInterface* pInterface = ((CPhysicalSAInterface*)GetInterface())->m_pAttachedEntity;
if (pInterface)
{
CPools* pPools = pGame->GetPools();
return pPools->GetEntity((DWORD*)pInterface);
return pGame->GetPools()->GetEntity((DWORD*)pInterface);
}
return nullptr;
}
Expand Down
7 changes: 3 additions & 4 deletions Client/game_sa/CPlayerPedSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ CPlayerPedSA::CPlayerPedSA(unsigned int nModelIndex)
SetInterface((CEntitySAInterface*)dwPedPointer);

Init(); // init our interfaces
CPoolsSA* pools = (CPoolsSA*)pGame->GetPools();
auto pools = pGame->GetPools();
CWorldSA* world = (CWorldSA*)pGame->GetWorld();

SetModelIndex(nModelIndex);
Expand All @@ -65,7 +65,7 @@ CPlayerPedSA::CPlayerPedSA(unsigned int nModelIndex)
m_pData = new CPlayerPedDataSAInterface;

// Copy the local player data so we're defaulted to something good
CPlayerPedSA* pLocalPlayerSA = dynamic_cast<CPlayerPedSA*>(pools->GetPedFromRef((DWORD)1));
CPlayerPedSA* pLocalPlayerSA = dynamic_cast<CPlayerPedSA*>(pools->GetPedFromRef(1UL));
if (pLocalPlayerSA)
MemCpyFast(m_pData, ((CPlayerPedSAInterface*)pLocalPlayerSA->GetInterface())->pPlayerData, sizeof(CPlayerPedDataSAInterface));

Expand Down Expand Up @@ -104,7 +104,6 @@ CPlayerPedSA::CPlayerPedSA(CPlayerPedSAInterface* pPlayer)
SetInterface((CEntitySAInterface*)pPlayer);

Init();
CPoolsSA* pools = (CPoolsSA*)pGame->GetPools();
SetType(PLAYER_PED);
BeingDeleted = false;

Expand Down Expand Up @@ -149,7 +148,7 @@ CPlayerPedSA::~CPlayerPedSA()
}
}
BeingDeleted = true;
((CPoolsSA*)pGame->GetPools())->RemovePed((CPed*)(CPedSA*)this, false);
pGame->GetPools()->RemovePed((CPed*)(CPedSA*)this, false);
}

// Delete the player data
Expand Down
2 changes: 1 addition & 1 deletion Client/game_sa/CTasksSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ __declspec(noinline) void _cdecl OnCEventHandler_ComputeDamageResponse_Mid(CPedS
ePedPieceTypes hitBodyPart, int hitBodySide, int weaponId)
{
// Make sure victim is local player
CPedSAInterface* pLocalPlayer = ((CPoolsSA*)pGame->GetPools())->GetPedInterface((DWORD)1);
CPedSAInterface* pLocalPlayer = std::static_pointer_cast<CPoolsSA>(pGame->GetPools())->GetPedInterface(1UL);
if (pPedVictim != pLocalPlayer)
return;

Expand Down
19 changes: 8 additions & 11 deletions Client/game_sa/CVehicleSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ CVehicleSA::~CVehicleSA()
}
}
BeingDeleted = true;
((CPoolsSA*)pGame->GetPools())->RemoveVehicle((CVehicle*)this);
pGame->GetPools()->RemoveVehicle((CVehicle*)this);
}
}

Expand Down Expand Up @@ -830,12 +830,11 @@ void CVehicleSA::SetEngineOn(bool bEngineOn)

CPed* CVehicleSA::GetDriver()
{
CPoolsSA* pPools = (CPoolsSA*)pGame->GetPools();

auto pools = pGame->GetPools();
CPedSAInterface* pDriver = GetVehicleInterface()->pDriver;
if (pDriver)
if (pools && pDriver)
{
SClientEntity<CPedSA>* pPedClientEntity = pPools->GetPed((DWORD*)pDriver);
SClientEntity<CPedSA>* pPedClientEntity = pools->GetPed((DWORD*)pDriver);
if (pPedClientEntity)
{
return pPedClientEntity->pEntity;
Expand All @@ -846,14 +845,13 @@ CPed* CVehicleSA::GetDriver()

CPed* CVehicleSA::GetPassenger(unsigned char ucSlot)
{
CPoolsSA* pPools = (CPoolsSA*)pGame->GetPools();

if (ucSlot < 8)
auto pools = pGame->GetPools();
if (pools && ucSlot < 8)
{
CPedSAInterface* pPassenger = GetVehicleInterface()->pPassengers[ucSlot];
if (pPassenger)
{
SClientEntity<CPedSA>* pPedClientEntity = pPools->GetPed((DWORD*)pPassenger);
SClientEntity<CPedSA>* pPedClientEntity = pools->GetPed((DWORD*)pPassenger);
if (pPedClientEntity)
{
return pPedClientEntity->pEntity;
Expand Down Expand Up @@ -1247,8 +1245,7 @@ CPhysical* CVehicleSA::QueryPickedUpEntityWithWinch()

if (phys)
{
CPools* pPools = pGame->GetPools();
return reinterpret_cast<CPhysical*>(pPools->GetEntity((DWORD*)phys));
return reinterpret_cast<CPhysical*>(pGame->GetPools()->GetEntity((DWORD*)phys));
}
return nullptr;
}
Expand Down
10 changes: 5 additions & 5 deletions Client/game_sa/CWorldSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ bool CWorldSA::ProcessLineOfSight(const CVector* vecStart, const CVector* vecEnd
// Building info needed?
if (pBuildingResult)
{
CPoolsSA* pPools = ((CPoolsSA*)pGame->GetPools());
if (pPools)
auto pools = pGame->GetPools();
if (pools)
{
if (targetEntity && targetEntity->nType == ENTITY_TYPE_BUILDING)
{
Expand Down Expand Up @@ -498,12 +498,12 @@ bool CWorldSA::ProcessLineOfSight(const CVector* vecStart, const CVector* vecEnd

if (CollisionEntity)
{
CPools* pPools = pGame->GetPools();
if (pPools)
auto pools = pGame->GetPools();
if (pools)
{
if (targetEntity)
{
*CollisionEntity = pPools->GetEntity((DWORD*)targetEntity);
*CollisionEntity = pools->GetEntity((DWORD*)targetEntity);
}
}
}
Expand Down
Loading
Loading