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!
This commit is contained in:
parent
b306101d89
commit
0a08631df6
|
@ -104,10 +104,14 @@ namespace Blarg.GameFramework.Entities
|
|||
}
|
||||
|
||||
|
||||
public void GetAllWith<T>(EntityList list) where T : Component
|
||||
public void GetAllWith<T>(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;
|
||||
|
|
Reference in a new issue