From 19dbfbeb622101267a43ae7a87fc7e5fa2ccd588 Mon Sep 17 00:00:00 2001 From: Discover- Date: Mon, 4 Jun 2012 17:20:40 +0200 Subject: Core/SAI: Fixed a mistake in SMART_TARGET_INVOKER_PARTY which made it add the same player to the targetlist twice if there was a group. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 21dc92b25d1..e4c9e4a3047 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -2123,12 +2123,20 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* case SMART_TARGET_INVOKER_PARTY: if (trigger) { - l->push_back(trigger); if (Player* player = trigger->ToPlayer()) + { if (Group* group = player->GetGroup()) + { for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next()) if (Player* member = groupRef->getSource()) l->push_back(member); + } + // We still add the player to the list if there is no group. If we do + // this even if there is a group (thus the else-check), it will add the + // same player to the list twice. We don't want that to happen. + else + l->push_back(trigger); + } } break; case SMART_TARGET_CREATURE_RANGE: -- cgit v1.2.3