mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-15 08:53:51 +00:00
fix: clearTarget fired PLAYER_TARGET_CHANGED before zeroing targetGuid
Callbacks and addons querying the current target during this event saw the old (stale) target instead of null. setTarget correctly updates the GUID before firing — clearTarget now does the same.
This commit is contained in:
parent
bf63d8e385
commit
05cfcaacf6
1 changed files with 6 additions and 1 deletions
|
|
@ -1070,9 +1070,14 @@ void CombatHandler::setTarget(uint64_t guid) {
|
|||
void CombatHandler::clearTarget() {
|
||||
if (owner_.targetGuid != 0) {
|
||||
LOG_INFO("Target cleared");
|
||||
// Zero the GUID before firing the event so callbacks/addons that query
|
||||
// the current target see null (consistent with setTarget which updates
|
||||
// targetGuid before the event).
|
||||
owner_.targetGuid = 0;
|
||||
owner_.fireAddonEvent("PLAYER_TARGET_CHANGED", {});
|
||||
} else {
|
||||
owner_.targetGuid = 0;
|
||||
}
|
||||
owner_.targetGuid = 0;
|
||||
owner_.tabCycleIndex = -1;
|
||||
owner_.tabCycleStale = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue