From e2fd78b51063d4d38a065bddeddfc25b30fda373 Mon Sep 17 00:00:00 2001 From: j883376 Date: Sun, 5 May 2013 06:47:53 -0400 Subject: [PATCH 1/2] Fix Auto XTargets not clearing on death --- zone/attack.cpp | 1 + zone/client.cpp | 16 ++++++++++++++++ zone/client.h | 1 + 3 files changed, 18 insertions(+) diff --git a/zone/attack.cpp b/zone/attack.cpp index 1bbb6efa8..b311ac28c 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -1486,6 +1486,7 @@ void Client::Death(Mob* killerMob, int32 damage, uint16 spell, SkillType attack_ entity_list.RemoveFromTargets(this); hate_list.RemoveEnt(this); + RemoveAutoXTargets(); //remove ourself from all proximities diff --git a/zone/client.cpp b/zone/client.cpp index b468f922e..9f73e8371 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -6990,6 +6990,22 @@ void Client::RemoveGroupXTargets() } } +void Client::RemoveAutoXTargets() +{ + if(!XTargettingAvailable()) + return; + + for(int i = 0; i < GetMaxXTargets(); ++i) + { + if(XTargets[i].Type == Auto) + { + XTargets[i].ID = 0; + XTargets[i].Name[0] = 0; + SendXTargetPacket(i, NULL); + } + } +} + void Client::ShowXTargets(Client *c) { if(!c) diff --git a/zone/client.h b/zone/client.h index 2d7aa2ac7..93eb3b945 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1095,6 +1095,7 @@ public: void RemoveXTarget(Mob *m, bool OnlyAutoSlots); void SendXTargetPacket(uint32 Slot, Mob *m); void RemoveGroupXTargets(); + void RemoveAutoXTargets(); void ShowXTargets(Client *c); void InitializeMercInfo(); bool CheckCanHireMerc(Mob* merchant, uint32 template_id); From 4a0749f811a82709728928c818d68645c9a3fa35 Mon Sep 17 00:00:00 2001 From: j883376 Date: Sun, 5 May 2013 18:51:20 -0400 Subject: [PATCH 2/2] Change NULL to nullptr in RemoveAutoXTargets() --- zone/client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/client.cpp b/zone/client.cpp index 9f73e8371..6063bb306 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -7001,7 +7001,7 @@ void Client::RemoveAutoXTargets() { XTargets[i].ID = 0; XTargets[i].Name[0] = 0; - SendXTargetPacket(i, NULL); + SendXTargetPacket(i, nullptr); } } }