mirror of
				https://github.com/VCMP-SqMod/SqMod.git
				synced 2025-11-04 08:17:19 +01:00 
			
		
		
		
	Fix compilation errors and adjust the event syantax to imclude correct information for VehiclePartStatus, VehicleTyreStatus and VehicleHandling events.
Also fix a couple other compilation issues resulted from changes in syntax and bad copy paste.
This commit is contained in:
		@@ -1024,11 +1024,11 @@ public:
 | 
			
		||||
    void EmitVehicleOption(Int32 vehicle_id, Int32 option_id, bool value, Int32 header, Object & payload);
 | 
			
		||||
    void EmitVehicleWorld(Int32 vehicle_id, Int32 old_world, Int32 new_world);
 | 
			
		||||
    void EmitVehicleImmunity(Int32 vehicle_id, Int32 old_immunity, Int32 new_immunity);
 | 
			
		||||
    void EmitVehiclePartStatus(Int32 vehicle_id, Int32 old_status, Int32 new_status);
 | 
			
		||||
    void EmitVehicleTyreStatus(Int32 vehicle_id, Int32 old_status, Int32 new_status);
 | 
			
		||||
    void EmitVehiclePartStatus(Int32 vehicle_id, Int32 part, Int32 old_status, Int32 new_status);
 | 
			
		||||
    void EmitVehicleTyreStatus(Int32 vehicle_id, Int32 tyre, Int32 old_status, Int32 new_status);
 | 
			
		||||
    void EmitVehicleDamageData(Int32 vehicle_id, Uint32 old_data, Uint32 new_data);
 | 
			
		||||
    void EmitVehicleRadio(Int32 vehicle_id, Int32 old_radio, Int32 new_radio);
 | 
			
		||||
    void EmitVehicleHandlingRule(Int32 vehicle_id, Float32 old_data, Float32 new_data);
 | 
			
		||||
    void EmitVehicleHandlingRule(Int32 vehicle_id, Int32 rule, Float32 old_data, Float32 new_data);
 | 
			
		||||
    void EmitServerOption(Int32 option, bool value, Int32 header, Object & payload);
 | 
			
		||||
    void EmitScriptReload(Int32 header, Object & payload);
 | 
			
		||||
    void EmitScriptLoaded();
 | 
			
		||||
 
 | 
			
		||||
@@ -855,19 +855,19 @@ void Core::EmitVehicleImmunity(Int32 vehicle_id, Int32 old_immunity, Int32 new_i
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------------------------------------------------------------------------------------------------
 | 
			
		||||
void Core::EmitVehiclePartStatus(Int32 vehicle_id, Int32 old_status, Int32 new_status)
 | 
			
		||||
void Core::EmitVehiclePartStatus(Int32 vehicle_id, Int32 part, Int32 old_status, Int32 new_status)
 | 
			
		||||
{
 | 
			
		||||
    VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
 | 
			
		||||
    Emit(_vehicle.mOnPartStatus, old_status, new_status);
 | 
			
		||||
    Emit(mOnVehiclePartStatus, _vehicle.mObj, old_status, new_status);
 | 
			
		||||
    Emit(_vehicle.mOnPartStatus, part, old_status, new_status);
 | 
			
		||||
    Emit(mOnVehiclePartStatus, _vehicle.mObj, part, old_status, new_status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------------------------------------------------------------------------------------------------
 | 
			
		||||
void Core::EmitVehicleTyreStatus(Int32 vehicle_id, Int32 old_status, Int32 new_status)
 | 
			
		||||
void Core::EmitVehicleTyreStatus(Int32 vehicle_id, Int32 tyre, Int32 old_status, Int32 new_status)
 | 
			
		||||
{
 | 
			
		||||
    VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
 | 
			
		||||
    Emit(_vehicle.mOnTyreStatus, old_status, new_status);
 | 
			
		||||
    Emit(mOnVehicleTyreStatus, _vehicle.mObj, old_status, new_status);
 | 
			
		||||
    Emit(_vehicle.mOnTyreStatus, tyre, old_status, new_status);
 | 
			
		||||
    Emit(mOnVehicleTyreStatus, _vehicle.mObj, tyre, old_status, new_status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------------------------------------------------------------------------------------------------
 | 
			
		||||
@@ -887,11 +887,11 @@ void Core::EmitVehicleRadio(Int32 vehicle_id, Int32 old_radio, Int32 new_radio)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------------------------------------------------------------------------------------------------
 | 
			
		||||
void Core::EmitVehicleHandlingRule(Int32 vehicle_id, Float32 old_data, Float32 new_data)
 | 
			
		||||
void Core::EmitVehicleHandlingRule(Int32 vehicle_id, Int32 rule, Float32 old_data, Float32 new_data)
 | 
			
		||||
{
 | 
			
		||||
    VehicleInst & _vehicle = m_Vehicles.at(vehicle_id);
 | 
			
		||||
    Emit(_vehicle.mOnHandlingRule, old_data, new_data);
 | 
			
		||||
    Emit(mOnVehicleHandlingRule, _vehicle.mObj, old_data, new_data);
 | 
			
		||||
    Emit(_vehicle.mOnHandlingRule, rule, old_data, new_data);
 | 
			
		||||
    Emit(mOnVehicleHandlingRule, _vehicle.mObj, rule, old_data, new_data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------------------------------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
@@ -870,21 +870,21 @@ void CVehicle::SetPartStatus(Int32 part, Int32 status)
 | 
			
		||||
    // Validate the managed identifier
 | 
			
		||||
    Validate();
 | 
			
		||||
    // Grab the current value for this property
 | 
			
		||||
    const Int32 current = _Func->GetVehiclePartStatus(m_ID);
 | 
			
		||||
    const Int32 current = _Func->GetVehiclePartStatus(m_ID, part);
 | 
			
		||||
    // Don't even bother if it's the same value
 | 
			
		||||
    if (current == status)
 | 
			
		||||
    {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    // Avoid property unwind from a recursive call
 | 
			
		||||
    _Func->SetVehiclePartStatus(m_ID, status);
 | 
			
		||||
    _Func->SetVehiclePartStatus(m_ID, part, status);
 | 
			
		||||
    // Avoid infinite recursive event loops
 | 
			
		||||
    if (!(m_CircularLocks & VEHICLECL_EMIT_VEHICLE_PARTSTATUS))
 | 
			
		||||
    {
 | 
			
		||||
        // Prevent this event from triggering while executed
 | 
			
		||||
        BitGuardU32 bg(m_CircularLocks, VEHICLECL_EMIT_VEHICLE_PARTSTATUS);
 | 
			
		||||
        // Now forward the event call
 | 
			
		||||
        Core::Get().EmitVehiclePartStatus(m_ID, current, status);
 | 
			
		||||
        Core::Get().EmitVehiclePartStatus(m_ID, part, current, status);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -894,7 +894,7 @@ Int32 CVehicle::GetTyreStatus(Int32 tyre) const
 | 
			
		||||
    // Validate the managed identifier
 | 
			
		||||
    Validate();
 | 
			
		||||
    // Return the requested information
 | 
			
		||||
    return _Func->(m_ID, tyre);
 | 
			
		||||
    return _Func->GetVehicleTyreStatus(m_ID, tyre);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------------------------------------------------------------------------------------------------
 | 
			
		||||
@@ -903,21 +903,21 @@ void CVehicle::SetTyreStatus(Int32 tyre, Int32 status)
 | 
			
		||||
    // Validate the managed identifier
 | 
			
		||||
    Validate();
 | 
			
		||||
    // Grab the current value for this property
 | 
			
		||||
    const Int32 current = _Func->GetVehicleTyreStatus(m_ID);
 | 
			
		||||
    const Int32 current = _Func->GetVehicleTyreStatus(m_ID, tyre);
 | 
			
		||||
    // Don't even bother if it's the same value
 | 
			
		||||
    if (current == status)
 | 
			
		||||
    {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    // Avoid property unwind from a recursive call
 | 
			
		||||
    _Func->SetVehicleTyreStatus(m_ID, status);
 | 
			
		||||
    _Func->SetVehicleTyreStatus(m_ID, tyre, status);
 | 
			
		||||
    // Avoid infinite recursive event loops
 | 
			
		||||
    if (!(m_CircularLocks & VEHICLECL_EMIT_VEHICLE_TYRESTATUS))
 | 
			
		||||
    {
 | 
			
		||||
        // Prevent this event from triggering while executed
 | 
			
		||||
        BitGuardU32 bg(m_CircularLocks, VEHICLECL_EMIT_VEHICLE_TYRESTATUS);
 | 
			
		||||
        // Now forward the event call
 | 
			
		||||
        Core::Get().EmitVehicleTyreStatus(m_ID, current, status);
 | 
			
		||||
        Core::Get().EmitVehicleTyreStatus(m_ID, tyre, current, status);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1059,7 +1059,7 @@ void CVehicle::SetHandlingRule(Int32 rule, Float32 data)
 | 
			
		||||
        // Prevent this event from triggering while executed
 | 
			
		||||
        BitGuardU32 bg(m_CircularLocks, VEHICLECL_EMIT_VEHICLE_HANDLINGRULE);
 | 
			
		||||
        // Now forward the event call
 | 
			
		||||
        Core::Get().EmitVehicleHandlingRule(m_ID, current, data);
 | 
			
		||||
        Core::Get().EmitVehicleHandlingRule(m_ID, rule, current, data);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1078,7 +1078,7 @@ void CVehicle::ResetHandlingRule(Int32 rule)
 | 
			
		||||
        // Prevent this event from triggering while executed
 | 
			
		||||
        BitGuardU32 bg(m_CircularLocks, VEHICLECL_EMIT_VEHICLE_HANDLINGRULE);
 | 
			
		||||
        // Now forward the event call
 | 
			
		||||
        Core::Get().EmitVehicleHandlingRule(m_ID, current, _Func->GetInstHandlingRule(m_ID, rule));
 | 
			
		||||
        Core::Get().EmitVehicleHandlingRule(m_ID, rule, current, _Func->GetInstHandlingRule(m_ID, rule));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1914,7 +1914,7 @@ void Register_CVehicle(HSQUIRRELVM vm)
 | 
			
		||||
            (_SC("AddRelativeTurnSpeed"), &CVehicle::AddRelativeTurnSpeedEx)
 | 
			
		||||
        .Overload< void (CVehicle::*)(void) const >
 | 
			
		||||
            (_SC("ResetHandling"), &CVehicle::ResetHandlings)
 | 
			
		||||
        .Overload< void (CVehicle::*)(Int32) const >
 | 
			
		||||
        .Overload< void (CVehicle::*)(Int32) >
 | 
			
		||||
            (_SC("ResetHandling"), &CVehicle::ResetHandlingRule)
 | 
			
		||||
        .Overload< bool (CVehicle::*)(CPlayer &) const >
 | 
			
		||||
            (_SC("Embark"), &CVehicle::Embark)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user