Core/Player: Fix MAX_TITLE_INDEX calculation for title mask (#461)
* Core/Player: Fix MAX_TITLE_INDEX calculation for title mask * Core/Player: Replace sizeof-based bit calculation with explicit 64
This commit is contained in:
2 files changed
+5
-2
No files matched your search
@@ -24916,7 +24916,9 @@ bool Player::isTotalImmune() const
|
||||
|
||||
bool Player::HasTitle(uint32 bitIndex) const
|
||||
{
|
||||
if (bitIndex > MAX_TITLE_INDEX)
|
||||
// bitIndex is zero-based inside PLAYER__FIELD_KNOWN_TITLES.
|
||||
// MAX_TITLE_INDEX is the total number of available bits (valid range: [0, MAX_TITLE_INDEX)).
|
||||
if (bitIndex >= MAX_TITLE_INDEX)
|
||||
return false;
|
||||
|
||||
uint32 fieldIndexOffset = bitIndex / 32;
|
||||
|
||||
@@ -479,8 +479,9 @@ static_assert((PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID & 1) == 0, "PLAYER
|
||||
|
||||
constexpr uint8 PLAYER_BYTES_2_OVERRIDE_SPELLS_UINT16_OFFSET = PLAYER_FIELD_BYTES_2_OFFSET_OVERRIDE_SPELLS_ID / 2;
|
||||
|
||||
// KNOWN_TITLES is stored in 4 uint64 values, so we can represent 256 title bits (4 * 64).
|
||||
constexpr uint8 KNOWN_TITLES_SIZE = 4;
|
||||
constexpr uint32 MAX_TITLE_INDEX = KNOWN_TITLES_SIZE * sizeof(uint64); // 4 uint64 fields
|
||||
constexpr uint32 MAX_TITLE_INDEX = KNOWN_TITLES_SIZE * 64;
|
||||
|
||||
// used in PLAYER_FIELD_BYTES values
|
||||
enum PlayerFieldByteFlags
|
||||
|
||||
Reference in new issue
Block a user