diff options
Diffstat (limited to 'src/crepe')
-rw-r--r-- | src/crepe/ComponentManager.cpp | 8 | ||||
-rw-r--r-- | src/crepe/ComponentManager.h | 2 |
2 files changed, 1 insertions, 9 deletions
diff --git a/src/crepe/ComponentManager.cpp b/src/crepe/ComponentManager.cpp index a90502d..e99419e 100644 --- a/src/crepe/ComponentManager.cpp +++ b/src/crepe/ComponentManager.cpp @@ -39,19 +39,11 @@ GameObject ComponentManager::new_object(const string & name, const string & tag, // Find the first available id (taking persistent objects into account) while (this->persistent[this->next_id]) { this->next_id++; - // Make sure that the persistent vector is large enough - if (persistent.size() <= next_id) { - this->persistent.resize(next_id + 1, false); - } } GameObject object{*this, this->next_id, name, tag, position, rotation, scale}; this->next_id++; - // Make sure that the persistent vector is large enough - if (persistent.size() <= next_id) { - this->persistent.resize(next_id + 1, false); - } return object; } diff --git a/src/crepe/ComponentManager.h b/src/crepe/ComponentManager.h index 810bc38..8462698 100644 --- a/src/crepe/ComponentManager.h +++ b/src/crepe/ComponentManager.h @@ -147,7 +147,7 @@ private: components; //! Persistent flag for each GameObject - std::vector<bool> persistent = {false}; + std::unordered_map<game_object_id_t, bool> persistent; //! ID of next GameObject allocated by \c ComponentManager::new_object game_object_id_t next_id = 0; |