From 0a08631df6de4c579697cf40661eae269b3bd6ac Mon Sep 17 00:00:00 2001 From: gered Date: Sun, 1 Sep 2013 03:43:15 -0400 Subject: [PATCH] GetAllWith() now by default clears the list before adding entities. new argument allow caller to specify behaviour Because, holy shit, I just spent too long trying to figure out the most bizarre bug that was being caused by the list *not* being cleared and I forgot that I had to with the way this was written originally! --- Blarg.GameFramework/Entities/EntityManager.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Blarg.GameFramework/Entities/EntityManager.cs b/Blarg.GameFramework/Entities/EntityManager.cs index e018aab..30a24c4 100644 --- a/Blarg.GameFramework/Entities/EntityManager.cs +++ b/Blarg.GameFramework/Entities/EntityManager.cs @@ -104,10 +104,14 @@ namespace Blarg.GameFramework.Entities } - public void GetAllWith(EntityList list) where T : Component + public void GetAllWith(EntityList list, bool clearListFirst = true) where T : Component { if (list == null) throw new ArgumentNullException("list", "Must provide a list to store matching Entity's in."); + + if (clearListFirst) + list.Clear(); + EntityToComponentMap componentEntities = _components.Get(typeof(T)); if (componentEntities == null) return;