diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2018-04-30 23:11:30 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2018-04-30 23:11:30 +0100 |
commit | 448e543b925ef1048b4a1a7abfc4a7a0c16a05eb (patch) | |
tree | d484d9593457143b4d4c95c9cddc42d4597707e4 | |
parent | b9db19ca3f12932b1968a99c2213886167efed81 (diff) | |
download | YAGE-448e543b925ef1048b4a1a7abfc4a7a0c16a05eb.tar.gz YAGE-448e543b925ef1048b4a1a7abfc4a7a0c16a05eb.zip |
Fixed types and removed unnecessary function
-rw-r--r-- | yage/entity/entity.h | 2 | ||||
-rw-r--r-- | yage/entity/entitymanager.cpp | 13 | ||||
-rw-r--r-- | yage/entity/entitymanager.h | 10 |
3 files changed, 6 insertions, 19 deletions
diff --git a/yage/entity/entity.h b/yage/entity/entity.h index 097c1fa2..9ba0d46d 100644 --- a/yage/entity/entity.h +++ b/yage/entity/entity.h @@ -14,7 +14,7 @@ namespace yage { -typedef unsigned int Handle; +typedef unsigned int Entity; } // namespace yage diff --git a/yage/entity/entitymanager.cpp b/yage/entity/entitymanager.cpp index 332ed9b8..5eb17075 100644 --- a/yage/entity/entitymanager.cpp +++ b/yage/entity/entitymanager.cpp @@ -11,22 +11,17 @@ namespace yage { -EntityManager::EntityManager(Space *space) : next_handle_(0), space_(space) {} +EntityManager::EntityManager(Space *space) : space_(space) {} EntityManager::EntityManager(Space *space, std::size_t n) - : next_handle_(0), space_(space) + : space_(space) { entities_.reserve(n); } -unsigned EntityManager::createEntity() +Entity EntityManager::createEntity() { - return createEntityInstance().getHandle(); -} - -Entity EntityManager::createEntityInstance() -{ - Entity entity(next_handle_++); + Entity entity = next_entity_++; entities_.push_back(entity); return entity; } diff --git a/yage/entity/entitymanager.h b/yage/entity/entitymanager.h index da125d94..85ad9051 100644 --- a/yage/entity/entitymanager.h +++ b/yage/entity/entitymanager.h @@ -53,19 +53,11 @@ public: */ unsigned createEntity(); - /** - * Creates an Entity and returns it. - * - * @return The entity that was created by the entity manager in the current - * space. - */ - Entity createEntityInstance(); - private: /** * The next available handle to give to the user. */ - unsigned next_handle_; + Entity next_entity_ = 0; /** * The space that the entity manager belongs to. |