Merge pull request #135 from SHADE-DP/SP3-5-ECS

Sp3 5 ecs
Added GetEntityByName to EntityManager.
Defaults to MAX_EID if none are found.
This commit is contained in:
XiaoQiDigipen 2022-10-31 15:10:53 +08:00 committed by GitHub
commit 2a31ea6798
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -213,5 +213,14 @@ namespace SHADE
return SHSerialization::DeserializeEntityToSceneFromString(data);
}*/
EntityID SHEntityManager::GetEntityByName(std::string const& name) noexcept
{
EntityID result = MAX_EID;
for (auto& entity : entityVec)
{
if (entity->name == name)
result = entity->GetEID();
}
return result;
}
}

View File

@ -209,6 +209,8 @@ namespace SHADE
//static EntityID DuplicateEntity(EntityID eid) noexcept;
static EntityID GetEntityByName(std::string const& name) noexcept;
protected: