/* core/entity.cc This file is part of the Osirion project and is distributed under the terms of the GNU General Public License version 2. */ #include "sys/sys.h" #include "core/entity.h" #include namespace core { Entity::Entity(unsigned int entity_type, unsigned int entity_flags) { flags = entity_flags; type = entity_type; core::entity::add(this); } Entity::~Entity() { } namespace entity { std::vector registry; void add(Entity *ent) { ent->id = (unsigned int) registry.size(); registry.push_back(ent); } void clear() { std::vector::iterator it; for (it=registry.begin(); it != registry.end(); it++) { delete (*it); (*it) = 0; } registry.clear(); } void list() { std::vector::iterator it; for (it=registry.begin(); it != registry.end(); it++) { con_print << " id " << std::setw(3) << (*it)->id << " type " << std::setw(2) << (*it)->type << std::endl; } con_print << registry.size() << " registered entities" << std::endl; } } }