1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Fix a couple narrowing conversions in player entity.

This commit is contained in:
Sandu Liviu Catalin 2021-07-23 17:29:23 +03:00
parent 79b5641b9f
commit 47519cb3f4
2 changed files with 10 additions and 10 deletions

View File

@ -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 the managed identifier
Validate(); 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 the managed identifier
Validate(); Validate();
// Grab the current value for this property // 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 // Avoid property unwind from a recursive call
_Func->SetPlayerImmunityFlags(m_ID, static_cast< uint32_t >(flags)); _Func->SetPlayerImmunityFlags(m_ID, static_cast< uint32_t >(flags));
// Avoid infinite recursive event loops // Avoid infinite recursive event loops
@ -840,7 +840,7 @@ void CPlayer::SetImmunity(int32_t flags)
// Prevent this event from triggering while executed // Prevent this event from triggering while executed
BitGuardU32 bg(m_CircularLocks, PLAYERCL_EMIT_PLAYER_IMMUNITY); BitGuardU32 bg(m_CircularLocks, PLAYERCL_EMIT_PLAYER_IMMUNITY);
// Now forward the event call // 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 the managed identifier
Validate(); 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(); return m_Buffer.Position();
} }

View File

@ -488,12 +488,12 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the immunity flags of the managed player entity. * 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. * 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. * Retrieve the position of the managed player entity.
@ -588,7 +588,7 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the game keys of the managed player entity. * 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. * Embark the managed player entity into the specified vehicle entity.
@ -959,7 +959,7 @@ public:
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
* Retrieve the current cursor position of the stream buffer. * 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. * Retrieve the current cursor position of the stream buffer.