From 47519cb3f45ec91aa3a0f25e8a41e5f609411ffb Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Fri, 23 Jul 2021 17:29:23 +0300 Subject: [PATCH] Fix a couple narrowing conversions in player entity. --- module/Entity/Player.cpp | 12 ++++++------ module/Entity/Player.hpp | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/module/Entity/Player.cpp b/module/Entity/Player.cpp index 639eb9d1..63a9597f 100644 --- a/module/Entity/Player.cpp +++ b/module/Entity/Player.cpp @@ -817,7 +817,7 @@ void CPlayer::SetArmor(float amount) const } // ------------------------------------------------------------------------------------------------ -int32_t CPlayer::GetImmunity() const +uint32_t CPlayer::GetImmunity() const { // Validate the managed identifier Validate(); @@ -826,12 +826,12 @@ int32_t CPlayer::GetImmunity() const } // ------------------------------------------------------------------------------------------------ -void CPlayer::SetImmunity(int32_t flags) +void CPlayer::SetImmunity(uint32_t flags) { // Validate the managed identifier Validate(); // Grab the current value for this property - const int32_t current = _Func->GetPlayerImmunityFlags(m_ID); + const uint32_t current = _Func->GetPlayerImmunityFlags(m_ID); // Avoid property unwind from a recursive call _Func->SetPlayerImmunityFlags(m_ID, static_cast< uint32_t >(flags)); // Avoid infinite recursive event loops @@ -840,7 +840,7 @@ void CPlayer::SetImmunity(int32_t flags) // Prevent this event from triggering while executed BitGuardU32 bg(m_CircularLocks, PLAYERCL_EMIT_PLAYER_IMMUNITY); // Now forward the event call - Core::Get().EmitPlayerImmunity(m_ID, current, flags); + Core::Get().EmitPlayerImmunity(m_ID, static_cast< int32_t >(current), static_cast< int32_t >(flags)); } } @@ -1035,7 +1035,7 @@ int32_t CPlayer::GetAction() const } // ------------------------------------------------------------------------------------------------ -int32_t CPlayer::GetGameKeys() const +uint32_t CPlayer::GetGameKeys() const { // Validate the managed identifier Validate(); @@ -1845,7 +1845,7 @@ void CPlayer::StartStreamEx(uint32_t size) } // ------------------------------------------------------------------------------------------------ -int32_t CPlayer::GetBufferCursor() const +uint32_t CPlayer::GetBufferCursor() const { return m_Buffer.Position(); } diff --git a/module/Entity/Player.hpp b/module/Entity/Player.hpp index e2989505..912a5f5d 100644 --- a/module/Entity/Player.hpp +++ b/module/Entity/Player.hpp @@ -488,12 +488,12 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the immunity flags of the managed player entity. */ - SQMOD_NODISCARD int32_t GetImmunity() const; + SQMOD_NODISCARD uint32_t GetImmunity() const; /* -------------------------------------------------------------------------------------------- * Modify the immunity flags of the managed player entity. */ - void SetImmunity(int32_t flags); + void SetImmunity(uint32_t flags); /* -------------------------------------------------------------------------------------------- * Retrieve the position of the managed player entity. @@ -588,7 +588,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the game keys of the managed player entity. */ - SQMOD_NODISCARD int32_t GetGameKeys() const; + SQMOD_NODISCARD uint32_t GetGameKeys() const; /* -------------------------------------------------------------------------------------------- * Embark the managed player entity into the specified vehicle entity. @@ -959,7 +959,7 @@ public: /* -------------------------------------------------------------------------------------------- * Retrieve the current cursor position of the stream buffer. */ - SQMOD_NODISCARD int32_t GetBufferCursor() const; + SQMOD_NODISCARD uint32_t GetBufferCursor() const; /* -------------------------------------------------------------------------------------------- * Retrieve the current cursor position of the stream buffer.