diff options
Diffstat (limited to 'engine/object.cpp')
-rw-r--r-- | engine/object.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/engine/object.cpp b/engine/object.cpp deleted file mode 100644 index 7134061..0000000 --- a/engine/object.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "core/object.hpp" - -#include <stdlib.h> - -using namespace std; -using namespace flat::core; - -list<object*> object::all_objects; - -object::object() -{ - /* Collect this object */ - object::all_objects.push_back(this); -} - -object::~object() -{ - /* Eliminate this object reference */ - object::all_objects.remove(this); -} - -void object::set_id(const string& id) -{ - this->id = id; -} - -const string& object::get_id() const -{ - return id; -} - -string object::random_id(uint8_t length) { - - string out; - - for (uint8_t i = 0; i < length; ++i) - out += (char)(rand() % 93 + 33); - - return out; -} - -bool object::is_allocated(object *obj) -{ - for (object * o : object::all_objects) - { - if (o == obj) - return true; - } - - return false; -} - -vector<object*>& object::get_by_id(const string& id, vector<object*>& l) -{ - for (object * obj : object::all_objects) - { - if (id == obj->get_id()) - l.push_back(obj); - } - - return l; -} |