#include "ComponentSystem.h"

void ComponentSystemBase::AddEntity(EntityId entityId)
{
	m_registeredEntities.push_back(entityId);
}

void ComponentSystemBase::RemoveEntity(EntityId entityId)
{
	for (int i = 0; i < m_registeredEntities.size(); i++)
	{
		if (m_registeredEntities[i].index == entityId.index
			&& m_registeredEntities[i].salt == entityId.salt)
		{
			m_registeredEntities.erase(m_registeredEntities.begin() + i);
			return;
		}
	}
}

bool ComponentSystemBase::HasEntity(EntityId entityId)
{
	for (int i = 0; i < m_registeredEntities.size(); i++)
	{
		if (m_registeredEntities[i] == entityId)
		{
			return true;
		}
	}

	return false;
}
