Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-13 00:40:59 +0000
committerStijn Buys <ingar@osirion.org>2008-02-13 00:40:59 +0000
commit1f95c377b2abfaa454b1f2298af10956d95ad941 (patch)
tree2715cf49a8de16921775eff0dc1ac0ceace145b2 /src/core/entity.cc
parent468ab7f566ee493b8c7ff6a95763d99ed2ccc200 (diff)
split client from game module
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r--src/core/entity.cc30
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);
+ }
+ }
+}
+
}
}