Skip to content
Merged
Changes from all commits
Commits
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
11 changes: 10 additions & 1 deletion Client/mods/deathmatch/logic/CVehicleUpgrades.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ bool CVehicleUpgrades::IsUpgradeCompatible(unsigned short usUpgrade)
return false;

unsigned short usModel = m_pVehicle->GetModel();
auto* modelInfo = g_pGame->GetModelInfo(usModel);

if (modelInfo && modelInfo->GetParentID() != 0)
usModel = modelInfo->GetParentID();

// Wheels should be compatible with any vehicle which have wheels, except
// bike/bmx (they're buggy). Vortex is technically a car, but it has no
// wheels.
Expand Down Expand Up @@ -361,8 +366,12 @@ bool CVehicleUpgrades::IsUpgradeCompatible(unsigned short usUpgrade)
// Allow slot 2 to be upgraded regardless of ID and then check it has the required part
if (GetSlotFromUpgrade(us, ucSlot) && (bReturn || ucSlot == 2))
{

// Get our model supported upgrades
SVehicleSupportedUpgrades supportedUpgrades = m_pVehicle->GetModelInfo()->GetVehicleSupportedUpgrades();
auto* info = g_pGame->GetModelInfo(usModel);
modelInfo = info ? info : m_pVehicle->GetModelInfo();
SVehicleSupportedUpgrades supportedUpgrades = modelInfo->GetVehicleSupportedUpgrades();

// Initialisation happens when we load the clump which is done when we require a specific model rather than in bulk
if (supportedUpgrades.m_bInitialised == true)
{
Expand Down