Skip to content

Commit 6f2f32c

Browse files
Synchronize changes from 1.6 master branch [ci skip]
36416b2 Other fixes for #3848 (#3900)
2 parents cd8345c + 36416b2 commit 6f2f32c

File tree

10 files changed

+543
-507
lines changed

10 files changed

+543
-507
lines changed

Client/game_sa/CGameSA.cpp

Lines changed: 181 additions & 156 deletions
Large diffs are not rendered by default.

Client/game_sa/CHandlingEntrySA.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CHandlingEntrySA::CHandlingEntrySA()
2121
// Create a new interface and zero it
2222
if (m_HandlingSA = std::make_unique<tHandlingDataSA>())
2323
{
24-
MemSet(m_HandlingSA.get(), 0, sizeof(tHandlingDataSA));
24+
MemSetFast(m_HandlingSA.get(), 0, sizeof(tHandlingDataSA));
2525
}
2626
}
2727

@@ -31,7 +31,7 @@ CHandlingEntrySA::CHandlingEntrySA(const tHandlingDataSA* const pOriginal)
3131
m_HandlingSA = nullptr;
3232
if (pOriginal)
3333
{
34-
MemCpy(&m_Handling, pOriginal, sizeof(tHandlingDataSA));
34+
MemCpyFast(&m_Handling, pOriginal, sizeof(tHandlingDataSA));
3535
}
3636
}
3737

@@ -52,15 +52,9 @@ void CHandlingEntrySA::Recalculate() noexcept
5252
if (!m_HandlingSA)
5353
return;
5454

55-
try
56-
{
57-
// Copy our stored field to GTA's
58-
MemCpy(m_HandlingSA.get(), &m_Handling, sizeof(m_Handling));
59-
((void(_stdcall*)(tHandlingDataSA*))FUNC_HandlingDataMgr_ConvertDataToGameUnits)(m_HandlingSA.get());
60-
}
61-
catch (...)
62-
{
63-
}
55+
// Copy our stored field to GTA's
56+
MemCpyFast(m_HandlingSA.get(), &m_Handling, sizeof(m_Handling));
57+
((void(_stdcall*)(tHandlingDataSA*))FUNC_HandlingDataMgr_ConvertDataToGameUnits)(m_HandlingSA.get());
6458
}
6559

6660
void CHandlingEntrySA::SetSuspensionForceLevel(float fForce) noexcept

Client/mods/deathmatch/logic/luadefs/CLuaVehicleDefs.cpp

Lines changed: 206 additions & 192 deletions
Large diffs are not rendered by default.

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ bool CGame::Start(int iArgumentCount, char* szArguments[])
595595
m_pPlayerManager = new CPlayerManager;
596596
m_pRadarAreaManager = new CRadarAreaManager;
597597
m_pMarkerManager = new CMarkerManager(m_pColManager);
598-
m_HandlingManager = std::make_shared<CHandlingManager>();
598+
m_HandlingManager = std::make_unique<CHandlingManager>();
599599
m_pVehicleManager = new CVehicleManager;
600600
m_pPacketTranslator = new CPacketTranslator(m_pPlayerManager);
601601
m_pBanManager = new CBanManager;

Server/mods/deathmatch/logic/CGame.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class CGame
216216
bool IsFinished() { return m_bIsFinished; };
217217

218218
CMainConfig* GetConfig() { return m_pMainConfig; }
219-
std::shared_ptr<CHandlingManager> GetHandlingManager() { return m_HandlingManager; }
219+
CHandlingManager* GetHandlingManager() const noexcept { return m_HandlingManager.get(); }
220220
CMapManager* GetMapManager() { return m_pMapManager; }
221221
CPlayerManager* GetPlayerManager() { return m_pPlayerManager; }
222222
CObjectManager* GetObjectManager() { return m_pObjectManager; }
@@ -571,7 +571,7 @@ class CGame
571571
CSettings* m_pSettings;
572572
CZoneNames* m_pZoneNames;
573573
ASE* m_pASE;
574-
std::shared_ptr<CHandlingManager> m_HandlingManager;
574+
std::unique_ptr<CHandlingManager> m_HandlingManager;
575575
CRPCFunctions* m_pRPCFunctions;
576576
CLanBroadcast* m_pLanBroadcast;
577577
CWaterManager* m_pWaterManager;

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static CBanManager* m_pBanManager;
100100
static CPedManager* m_pPedManager;
101101
static CWaterManager* m_pWaterManager;
102102
static CCustomWeaponManager* m_pCustomWeaponManager;
103-
static std::shared_ptr<CHandlingManager> m_HandlingManager;
103+
static CHandlingManager* m_pHandlingManager;
104104

105105
// Used to run a function on all the children of the elements too
106106
#define RUN_CHILDREN(func) \
@@ -135,7 +135,7 @@ CStaticFunctionDefinitions::CStaticFunctionDefinitions(CGame* pGame)
135135
m_pPedManager = pGame->GetPedManager();
136136
m_pWaterManager = pGame->GetWaterManager();
137137
m_pCustomWeaponManager = pGame->GetCustomWeaponManager();
138-
m_HandlingManager = pGame->GetHandlingManager();
138+
m_pHandlingManager = pGame->GetHandlingManager();
139139
}
140140

141141
CStaticFunctionDefinitions::~CStaticFunctionDefinitions()
@@ -5492,11 +5492,11 @@ bool CStaticFunctionDefinitions::GetModelHandling(std::uint32_t model, eHandling
54925492
const CHandlingEntry* pEntry = nullptr;
54935493
if (bOriginal)
54945494
{
5495-
pEntry = m_HandlingManager->GetOriginalHandlingData(model);
5495+
pEntry = m_pHandlingManager->GetOriginalHandlingData(model);
54965496
}
54975497
else
54985498
{
5499-
pEntry = m_HandlingManager->GetModelHandlingData(model);
5499+
pEntry = m_pHandlingManager->GetModelHandlingData(model);
55005500
}
55015501

55025502
if (!pEntry)
@@ -5516,11 +5516,11 @@ bool CStaticFunctionDefinitions::GetModelHandling(std::uint32_t model, eHandling
55165516
const CHandlingEntry* pEntry = nullptr;
55175517
if (bOriginal)
55185518
{
5519-
pEntry = m_HandlingManager->GetOriginalHandlingData(model);
5519+
pEntry = m_pHandlingManager->GetOriginalHandlingData(model);
55205520
}
55215521
else
55225522
{
5523-
pEntry = m_HandlingManager->GetModelHandlingData(model);
5523+
pEntry = m_pHandlingManager->GetModelHandlingData(model);
55245524
}
55255525

55265526
if (!pEntry)
@@ -5534,11 +5534,11 @@ bool CStaticFunctionDefinitions::GetModelHandling(std::uint32_t model, eHandling
55345534
const CHandlingEntry* pEntry = nullptr;
55355535
if (bOriginal)
55365536
{
5537-
pEntry = m_HandlingManager->GetOriginalHandlingData(model);
5537+
pEntry = m_pHandlingManager->GetOriginalHandlingData(model);
55385538
}
55395539
else
55405540
{
5541-
pEntry = m_HandlingManager->GetModelHandlingData(model);
5541+
pEntry = m_pHandlingManager->GetModelHandlingData(model);
55425542
}
55435543

55445544
if (!pEntry)
@@ -5552,11 +5552,11 @@ bool CStaticFunctionDefinitions::GetModelHandling(std::uint32_t model, eHandling
55525552
const CHandlingEntry* pEntry = nullptr;
55535553
if (bOriginal)
55545554
{
5555-
pEntry = m_HandlingManager->GetOriginalHandlingData(model);
5555+
pEntry = m_pHandlingManager->GetOriginalHandlingData(model);
55565556
}
55575557
else
55585558
{
5559-
pEntry = m_HandlingManager->GetModelHandlingData(model);
5559+
pEntry = m_pHandlingManager->GetModelHandlingData(model);
55605560
}
55615561

55625562
if (!pEntry)
@@ -5570,11 +5570,11 @@ bool CStaticFunctionDefinitions::GetModelHandling(std::uint32_t model, eHandling
55705570
const CHandlingEntry* pEntry = nullptr;
55715571
if (bOriginal)
55725572
{
5573-
pEntry = m_HandlingManager->GetOriginalHandlingData(model);
5573+
pEntry = m_pHandlingManager->GetOriginalHandlingData(model);
55745574
}
55755575
else
55765576
{
5577-
pEntry = m_HandlingManager->GetModelHandlingData(model);
5577+
pEntry = m_pHandlingManager->GetModelHandlingData(model);
55785578
}
55795579

55805580
if (!pEntry)
@@ -5585,66 +5585,66 @@ bool CStaticFunctionDefinitions::GetModelHandling(std::uint32_t model, eHandling
55855585

55865586
bool CStaticFunctionDefinitions::SetModelHandling(std::uint32_t model, eHandlingProperty eProperty, float fValue)
55875587
{
5588-
CHandlingEntry* pEntry = m_HandlingManager->GetModelHandlingData(model);
5588+
CHandlingEntry* pEntry = m_pHandlingManager->GetModelHandlingData(model);
55895589
if (!pEntry)
55905590
return false;
55915591

55925592
if (!SetEntryHandling(pEntry, eProperty, fValue))
55935593
return false;
55945594

5595-
m_HandlingManager->SetModelHandlingHasChanged(model, true);
5595+
m_pHandlingManager->SetModelHandlingHasChanged(model, true);
55965596
return true;
55975597
}
55985598

55995599
bool CStaticFunctionDefinitions::SetModelHandling(std::uint32_t model, eHandlingProperty eProperty, CVector vecValue)
56005600
{
5601-
CHandlingEntry* pEntry = m_HandlingManager->GetModelHandlingData(model);
5601+
CHandlingEntry* pEntry = m_pHandlingManager->GetModelHandlingData(model);
56025602
if (!pEntry)
56035603
return false;
56045604

56055605
if (!SetEntryHandling(pEntry, eProperty, vecValue))
56065606
return false;
56075607

5608-
m_HandlingManager->SetModelHandlingHasChanged(model, true);
5608+
m_pHandlingManager->SetModelHandlingHasChanged(model, true);
56095609
return true;
56105610
}
56115611

56125612
bool CStaticFunctionDefinitions::SetModelHandling(std::uint32_t model, eHandlingProperty eProperty, std::string strValue)
56135613
{
5614-
CHandlingEntry* pEntry = m_HandlingManager->GetModelHandlingData(model);
5614+
CHandlingEntry* pEntry = m_pHandlingManager->GetModelHandlingData(model);
56155615
if (!pEntry)
56165616
return false;
56175617

56185618
if (!SetEntryHandling(pEntry, eProperty, strValue))
56195619
return false;
56205620

5621-
m_HandlingManager->SetModelHandlingHasChanged(model, true);
5621+
m_pHandlingManager->SetModelHandlingHasChanged(model, true);
56225622
return true;
56235623
}
56245624

56255625
bool CStaticFunctionDefinitions::SetModelHandling(std::uint32_t model, eHandlingProperty eProperty, unsigned char ucValue)
56265626
{
5627-
CHandlingEntry* pEntry = m_HandlingManager->GetModelHandlingData(model);
5627+
CHandlingEntry* pEntry = m_pHandlingManager->GetModelHandlingData(model);
56285628
if (!pEntry)
56295629
return false;
56305630

56315631
if (!SetEntryHandling(pEntry, eProperty, ucValue))
56325632
return false;
56335633

5634-
m_HandlingManager->SetModelHandlingHasChanged(model, true);
5634+
m_pHandlingManager->SetModelHandlingHasChanged(model, true);
56355635
return true;
56365636
}
56375637

56385638
bool CStaticFunctionDefinitions::SetModelHandling(std::uint32_t model, eHandlingProperty eProperty, unsigned int uiValue)
56395639
{
5640-
CHandlingEntry* pEntry = m_HandlingManager->GetModelHandlingData(model);
5640+
CHandlingEntry* pEntry = m_pHandlingManager->GetModelHandlingData(model);
56415641
if (!pEntry)
56425642
return false;
56435643

56445644
if (!SetEntryHandling(pEntry, eProperty, uiValue))
56455645
return false;
56465646

5647-
m_HandlingManager->SetModelHandlingHasChanged(model, true);
5647+
m_pHandlingManager->SetModelHandlingHasChanged(model, true);
56485648
return true;
56495649
}
56505650

@@ -7406,15 +7406,15 @@ bool CStaticFunctionDefinitions::ResetVehicleHandling(CVehicle* pVehicle, bool b
74067406

74077407
if (bUseOriginal)
74087408
{
7409-
pNewEntry = m_HandlingManager->GetOriginalHandlingData(model);
7409+
pNewEntry = m_pHandlingManager->GetOriginalHandlingData(model);
74107410
if (!pNewEntry)
74117411
return false;
74127412

74137413
m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(pVehicle, RESET_VEHICLE_HANDLING, *BitStream.pBitStream));
74147414
}
74157415
else
74167416
{
7417-
pNewEntry = m_HandlingManager->GetModelHandlingData(model);
7417+
pNewEntry = m_pHandlingManager->GetModelHandlingData(model);
74187418
if (!pNewEntry)
74197419
return false;
74207420

@@ -7552,11 +7552,11 @@ bool CStaticFunctionDefinitions::ResetVehicleHandlingProperty(CVehicle* pVehicle
75527552

75537553
bool CStaticFunctionDefinitions::ResetModelHandling(std::uint32_t model)
75547554
{
7555-
CHandlingEntry* pEntry = m_HandlingManager->GetModelHandlingData(model);
7555+
CHandlingEntry* pEntry = m_pHandlingManager->GetModelHandlingData(model);
75567556
if (!pEntry)
75577557
return false;
75587558

7559-
const CHandlingEntry* pHandlingEntry = m_HandlingManager->GetOriginalHandlingData(model);
7559+
const CHandlingEntry* pHandlingEntry = m_pHandlingManager->GetOriginalHandlingData(model);
75607560
if (!pHandlingEntry)
75617561
return false;
75627562

@@ -7566,7 +7566,7 @@ bool CStaticFunctionDefinitions::ResetModelHandling(std::uint32_t model)
75667566

75677567
bool CStaticFunctionDefinitions::ResetModelHandlingProperty(std::uint32_t model, eHandlingProperty eProperty)
75687568
{
7569-
CHandlingEntry* pEntry = m_HandlingManager->GetModelHandlingData(model);
7569+
CHandlingEntry* pEntry = m_pHandlingManager->GetModelHandlingData(model);
75707570

75717571
float fValue;
75727572
CVector vecValue;

Server/mods/deathmatch/logic/CVehicle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ void CVehicle::GetInitialDoorStates(SFixedArray<unsigned char, MAX_DOORS>& ucOut
850850

851851
void CVehicle::GenerateHandlingData() noexcept
852852
{
853-
const auto handlingManager = g_pGame->GetHandlingManager();
853+
const auto* handlingManager = g_pGame->GetHandlingManager();
854854

855855
// Make a new CHandlingEntry
856856
if (!m_HandlingEntry)

Server/mods/deathmatch/logic/luadefs/CLuaDefs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace
4040

4141
CElementDeleter* CLuaDefs::m_pElementDeleter = NULL;
4242
CBlipManager* CLuaDefs::m_pBlipManager = NULL;
43-
std::shared_ptr<CHandlingManager> CLuaDefs::m_HandlingManager = nullptr;
43+
CHandlingManager* CLuaDefs::m_pHandlingManager = nullptr;
4444
CLuaManager* CLuaDefs::m_pLuaManager = NULL;
4545
CMarkerManager* CLuaDefs::m_pMarkerManager = NULL;
4646
CObjectManager* CLuaDefs::m_pObjectManager = NULL;
@@ -63,7 +63,7 @@ void CLuaDefs::Initialize(CGame* pGame)
6363
m_pRootElement = pGame->GetMapManager()->GetRootElement();
6464
m_pElementDeleter = pGame->GetElementDeleter();
6565
m_pBlipManager = pGame->GetBlipManager();
66-
m_HandlingManager = pGame->GetHandlingManager();
66+
m_pHandlingManager = pGame->GetHandlingManager();
6767
m_pLuaManager = pGame->GetLuaManager();
6868
m_pMarkerManager = pGame->GetMarkerManager();
6969
m_pObjectManager = pGame->GetObjectManager();

Server/mods/deathmatch/logic/luadefs/CLuaDefs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class CLuaDefs
6868
protected:
6969
static CElementDeleter* m_pElementDeleter;
7070
static CBlipManager* m_pBlipManager;
71-
static std::shared_ptr<CHandlingManager> m_HandlingManager;
71+
static CHandlingManager* m_pHandlingManager;
7272
static CLuaManager* m_pLuaManager;
7373
static CMarkerManager* m_pMarkerManager;
7474
static CObjectManager* m_pObjectManager;

0 commit comments

Comments
 (0)