diff options
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r-- | src/core/entity.cc | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc index b0808fb..6115e71 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -6,6 +6,7 @@ #include "sys/sys.h" #include "core/entity.h" + #include <iomanip> namespace core @@ -24,6 +25,7 @@ Entity::Entity(unsigned int entity_flags) core::entity::add(this); type = 0; + direction = 0; } Entity::~Entity() @@ -31,19 +33,28 @@ Entity::~Entity() // --- EntityDynamic ------------------------------------------ -EntityDynamic::EntityDynamic(unsigned int entity_flags) : - Entity(entity_flags), - speed(0,0,0) +EntityDynamic::EntityDynamic(unsigned int entity_flags) : + Entity(entity_flags) { + speed = 0.0f; +} +EntityDynamic::~EntityDynamic() +{ } // --- EntityControlable ------------------------------------------ -EntityControlable::EntityControlable(unsigned int entity_flags) : +EntityControlable::EntityControlable(unsigned int entity_flags) : EntityDynamic(entity_flags) { owner = 0; + target_direction = 0.0f; + target_thrust = 0.0f; +} + +EntityControlable::~EntityControlable() +{ } // --- namespace entity ------------------------------------------- @@ -97,6 +108,17 @@ void list() } con_print << registry.size() << " registered entities" << std::endl; } + +void frame(float seconds) +{ + std::vector<Entity *>::iterator it; + for (it=registry.begin(); it != registry.end(); it++) { + if ((*it)->core_type() == entity::Controlable) { + static_cast<EntityControlable *>(*it)->frame(seconds); + } + } +} + } } |