Browse Source

Experimental: add attackers to attackByList only for L2Attackable, other NPCs does not need it.
Should help with memory leaks in the non-cleared attackers lists for town NPCs.

_DS_ 15 years ago
parent
commit
bc326f6804

+ 12 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Attackable.java

@@ -856,6 +856,18 @@ public class L2Attackable extends L2Npc
 	}
 
 
+	/**
+	 * 
+	 * @see com.l2jserver.gameserver.model.actor.L2Character#addAttackerToAttackByList(com.l2jserver.gameserver.model.actor.L2Character)
+	 */
+	@Override
+	public void addAttackerToAttackByList (L2Character player)
+	{
+		if (player == null || player == this || getAttackByList().contains(player)) 
+			return;
+		getAttackByList().add(player);
+	}
+
 	/**
 	 * Add damage and hate to the attacker AggroInfo of the L2Attackable _aggroList.
 	 *

+ 4 - 3
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -446,12 +446,13 @@ public abstract class L2Character extends L2Object
 	/**
 	 * Add L2Character instance that is attacking to the attacker list.<BR><BR>
 	 * @param player The L2Character that attacks this one
+	 * 
+	 * <B><U> Overridden in </U> :</B><BR><BR>
+	 * <li> L2Attackable : Add to list only for attackables, not all other NPCs</li><BR><BR>
 	 */
 	public void addAttackerToAttackByList (L2Character player)
 	{
-		if (player == null || player == this || getAttackByList().contains(player)) 
-			return;
-		getAttackByList().add(player);
+		// DS: moved to L2Attackable
 	}
 
 	/**