diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-13 00:40:59 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-13 00:40:59 +0000 |
commit | 1f95c377b2abfaa454b1f2298af10956d95ad941 (patch) | |
tree | 2715cf49a8de16921775eff0dc1ac0ceace145b2 /src/core/entity.cc | |
parent | 468ab7f566ee493b8c7ff6a95763d99ed2ccc200 (diff) |
split client from game module
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); + } + } +} + } } |