From e2e9d2c83ff5b287b85e190dfd0c7728d9a34367 Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Fri, 23 Jul 2021 17:29:32 +0300 Subject: [PATCH] Fix a couple narrowing conversions in vehicle entity. --- module/Entity/Vehicle.cpp | 10 +++++----- module/Entity/Vehicle.hpp | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/module/Entity/Vehicle.cpp b/module/Entity/Vehicle.cpp index 861deb72..06e6e9f4 100644 --- a/module/Entity/Vehicle.cpp +++ b/module/Entity/Vehicle.cpp @@ -306,7 +306,7 @@ void CVehicle::Respawn() const } // ------------------------------------------------------------------------------------------------ -int32_t CVehicle::GetImmunity() const +uint32_t CVehicle::GetImmunity() const { // Validate the managed identifier Validate(); @@ -315,12 +315,12 @@ int32_t CVehicle::GetImmunity() const } // ------------------------------------------------------------------------------------------------ -void CVehicle::SetImmunity(int32_t flags) +void CVehicle::SetImmunity(uint32_t flags) { // Validate the managed identifier Validate(); // Grab the current value for this property - const int32_t current = _Func->GetVehicleImmunityFlags(m_ID); + const uint32_t current = _Func->GetVehicleImmunityFlags(m_ID); // Avoid property unwind from a recursive call _Func->SetVehicleImmunityFlags(m_ID, static_cast< uint32_t >(flags)); // Avoid infinite recursive event loops @@ -329,7 +329,7 @@ void CVehicle::SetImmunity(int32_t flags) // Prevent this event from triggering while executed BitGuardU32 bg(m_CircularLocks, VEHICLECL_EMIT_VEHICLE_IMMUNITY); // Now forward the event call - Core::Get().EmitVehicleImmunity(m_ID, current, flags); + Core::Get().EmitVehicleImmunity(m_ID, static_cast< int32_t >(current), static_cast< int32_t >(flags)); } } @@ -1130,7 +1130,7 @@ void CVehicle::ResetHandlings() const } // ------------------------------------------------------------------------------------------------ -int32_t CVehicle::GetLightsData() const +uint32_t CVehicle::GetLightsData() const { // Validate the managed identifier Validate(); diff --git a/module/Entity/Vehicle.hpp b/module/Entity/Vehicle.hpp index f9ef11c2..fb36138c 100644 --- a/module/Entity/Vehicle.hpp +++ b/module/Entity/Vehicle.hpp @@ -250,12 +250,12 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the immunity flags of the managed vehicle entity. */ - SQMOD_NODISCARD int32_t GetImmunity() const; + SQMOD_NODISCARD uint32_t GetImmunity() const; /* -------------------------------------------------------------------------------------------- * Modify the immunity flags of the managed vehicle entity. */ - void SetImmunity(int32_t flags); + void SetImmunity(uint32_t flags); /* -------------------------------------------------------------------------------------------- * Explode the managed vehicle entity. @@ -605,7 +605,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the lights data for the managed vehicle entity. */ - SQMOD_NODISCARD int32_t GetLightsData() const; + SQMOD_NODISCARD uint32_t GetLightsData() const; /* -------------------------------------------------------------------------------------------- * Modify the lights data for the managed vehicle entity.