Added error checking for config.json
This commit is contained in:
@ -37,7 +37,8 @@ template <typename T> inline ComponentID getComponentTypeID() noexcept
|
||||
}
|
||||
|
||||
constexpr std::size_t maxComponents = 32;
|
||||
constexpr std::size_t maxGroups =32;
|
||||
constexpr std::size_t maxGroups = 32;
|
||||
constexpr std::size_t maxEntities = 32;
|
||||
|
||||
using ComponentBitSet = std::bitset<maxComponents>;
|
||||
using GroupBitset = std::bitset<maxGroups>;
|
||||
@ -90,6 +91,14 @@ public:
|
||||
{
|
||||
groupBitset[mGroup] = false;
|
||||
}
|
||||
|
||||
std::string tag;
|
||||
void setTag(std::string t);
|
||||
|
||||
Entity* getEntity()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
template <typename T> bool hasComponent() const
|
||||
{
|
||||
@ -124,6 +133,7 @@ class Manager
|
||||
private:
|
||||
std::vector<std::unique_ptr<Entity>> entities;
|
||||
std::array<std::vector<Entity*>, maxGroups> groupedEntities;
|
||||
std::vector<std::vector<Entity*>> taggedEntities;
|
||||
public:
|
||||
void update()
|
||||
{
|
||||
@ -159,6 +169,19 @@ public:
|
||||
{
|
||||
groupedEntities[mGroup].emplace_back(mEntity);
|
||||
}
|
||||
|
||||
std::vector<Entity*> getEntitiesByTag(std::string t)
|
||||
{
|
||||
std::vector<Entity*> taggedEntities;
|
||||
for (int e = 0; e<=entities.size(); e++)
|
||||
{
|
||||
if (entities[e]->tag == t)
|
||||
{
|
||||
taggedEntities.emplace_back(entities[e]->getEntity());
|
||||
}
|
||||
}
|
||||
return taggedEntities;
|
||||
}
|
||||
|
||||
std::vector<Entity*>& getGroup(Group mGroup)
|
||||
{
|
||||
|
Reference in New Issue
Block a user