Skip to content

Commit 0e84628

Browse files
Synchronize changes from 1.6 master branch [ci skip]
e02a473 Fix vehicle upgrades (engineRequestModel) (#4398)
2 parents 5ea7468 + e02a473 commit 0e84628

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Client/mods/deathmatch/logic/CVehicleUpgrades.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ bool CVehicleUpgrades::IsUpgradeCompatible(unsigned short usUpgrade)
6464
return false;
6565

6666
unsigned short usModel = m_pVehicle->GetModel();
67+
auto* modelInfo = g_pGame->GetModelInfo(usModel);
68+
69+
if (modelInfo && modelInfo->GetParentID() != 0)
70+
usModel = modelInfo->GetParentID();
71+
6772
// Wheels should be compatible with any vehicle which have wheels, except
6873
// bike/bmx (they're buggy). Vortex is technically a car, but it has no
6974
// wheels.
@@ -361,8 +366,12 @@ bool CVehicleUpgrades::IsUpgradeCompatible(unsigned short usUpgrade)
361366
// Allow slot 2 to be upgraded regardless of ID and then check it has the required part
362367
if (GetSlotFromUpgrade(us, ucSlot) && (bReturn || ucSlot == 2))
363368
{
369+
364370
// Get our model supported upgrades
365-
SVehicleSupportedUpgrades supportedUpgrades = m_pVehicle->GetModelInfo()->GetVehicleSupportedUpgrades();
371+
auto* info = g_pGame->GetModelInfo(usModel);
372+
modelInfo = info ? info : m_pVehicle->GetModelInfo();
373+
SVehicleSupportedUpgrades supportedUpgrades = modelInfo->GetVehicleSupportedUpgrades();
374+
366375
// Initialisation happens when we load the clump which is done when we require a specific model rather than in bulk
367376
if (supportedUpgrades.m_bInitialised == true)
368377
{

0 commit comments

Comments
 (0)