fix(Core/Player): clear current title if the player loses it (#8827)
This commit is contained in:
@@ -12486,6 +12486,12 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost)
|
|||||||
if (!HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
|
if (!HasFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Clear the current title if it is the one being removed.
|
||||||
|
if (title->bit_index == GetUInt32Value(PLAYER_CHOSEN_TITLE))
|
||||||
|
{
|
||||||
|
SetCurrentTitle(nullptr, true);
|
||||||
|
}
|
||||||
|
|
||||||
RemoveFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
|
RemoveFlag(PLAYER__FIELD_KNOWN_TITLES + fieldIndexOffset, flag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -2495,6 +2495,7 @@ public:
|
|||||||
[[nodiscard]] bool HasTitle(uint32 bitIndex) const;
|
[[nodiscard]] bool HasTitle(uint32 bitIndex) const;
|
||||||
bool HasTitle(CharTitlesEntry const* title) const { return HasTitle(title->bit_index); }
|
bool HasTitle(CharTitlesEntry const* title) const { return HasTitle(title->bit_index); }
|
||||||
void SetTitle(CharTitlesEntry const* title, bool lost = false);
|
void SetTitle(CharTitlesEntry const* title, bool lost = false);
|
||||||
|
void SetCurrentTitle(CharTitlesEntry const* title, bool clear = false) { SetUInt32Value(PLAYER_CHOSEN_TITLE, clear ? 0 : title->bit_index); };
|
||||||
|
|
||||||
//bool isActiveObject() const { return true; }
|
//bool isActiveObject() const { return true; }
|
||||||
bool CanSeeSpellClickOn(Creature const* creature) const;
|
bool CanSeeSpellClickOn(Creature const* creature) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user