Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/entity.cc26
-rw-r--r--src/core/entity.h22
2 files changed, 24 insertions, 24 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 649212b..c62a412 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -388,7 +388,7 @@ EntityDynamic::EntityDynamic(unsigned int flags) :
Entity(flags)
{
entity_speed = 0.0f;
- entity_eventstate = Normal;
+ entity_state = Normal;
entity_timer = 0;
}
@@ -396,7 +396,7 @@ EntityDynamic::EntityDynamic(std::istream & is) :
Entity(is)
{
entity_speed = 0.0f;
- entity_eventstate = Normal;
+ entity_state = Normal;
entity_timer = 0;
}
@@ -404,10 +404,10 @@ EntityDynamic::~EntityDynamic()
{
}
-void EntityDynamic::set_eventstate(Event eventstate)
+void EntityDynamic::set_state(int state)
{
- if (entity_eventstate != eventstate) {
- entity_eventstate = eventstate;
+ if (entity_state != state) {
+ entity_state = state;
entity_dirty = true;
}
}
@@ -429,9 +429,9 @@ void EntityDynamic::serialize_server_create(std::ostream & os) const
{
Entity::serialize_server_create(os);
os << roundf(entity_speed * 100.0f) << " "
- << entity_eventstate << " ";
+ << entity_state << " ";
- if (entity_eventstate != Normal) {
+ if (entity_state != Normal) {
os << entity_timer << " ";
}
}
@@ -441,9 +441,9 @@ void EntityDynamic::receive_server_create(std::istream &is)
Entity::receive_server_create(is);
is >> entity_speed;
entity_speed /= 100.0f;
- is >> entity_eventstate;
+ is >> entity_state;
- if (entity_eventstate != Normal) {
+ if (entity_state != Normal) {
is >> entity_timer;
} else {
entity_timer = 0;
@@ -467,9 +467,9 @@ void EntityDynamic::serialize_server_update(std::ostream & os) const
<< entity_axis.forward() << " "
<< entity_axis.left() << " "
<< roundf(entity_speed * 100.0f) << " "
- << entity_eventstate << " ";
+ << entity_state << " ";
- if (entity_eventstate != Normal) {
+ if (entity_state != Normal) {
os << entity_timer << " ";
}
}
@@ -488,9 +488,9 @@ void EntityDynamic::receive_server_update(std::istream &is)
entity_axis[2] = math::crossproduct(entity_axis.forward(), entity_axis.left());
is >> entity_speed;
entity_speed /= 100.0f;
- is >> entity_eventstate;
+ is >> entity_state;
- if (entity_eventstate != Normal) {
+ if (entity_state != Normal) {
is >> entity_timer;
} else {
entity_timer = 0;
diff --git a/src/core/entity.h b/src/core/entity.h
index 596a701..b9ee6bd 100644
--- a/src/core/entity.h
+++ b/src/core/entity.h
@@ -47,8 +47,8 @@ public:
/// Entity shape constants
enum Shape {Diamond=0, Sphere=1, Cube=2, Axis=3};
- /// EntityDynamic event state classes
- enum Event {Normal=0, NoPower=1, ImpulseInitiate=2, Impulse=3, JumpInitiate=4, Jump=5, Docked=6};
+ /// EntityDynamic State constants
+ enum State {Normal=0, NoPower=1, ImpulseInitiate=2, Impulse=3, JumpInitiate=4, Jump=5, Docked=6, Destroyed=7};
/// entity menus collection typedef
typedef std::list<MenuDescription *> Menus;
@@ -71,7 +71,7 @@ public:
inline unsigned int moduletype() const { return entity_moduletypeid; }
/// core type id
- virtual inline unsigned int type() const { return Default; }
+ virtual inline const unsigned int type() const { return Default; }
/// entity flags
inline unsigned int flags() const { return entity_flags; }
@@ -306,16 +306,16 @@ public:
/*----- inspectors ------------------------------------------------ */
/// core type id
- virtual inline unsigned int type() const { return Entity::Dynamic; }
+ virtual inline const unsigned int type() const { return Entity::Dynamic; }
/// current speed of the entity in game units per second
- inline float speed() const { return entity_speed; }
+ inline const float speed() const { return entity_speed; }
/// event state
- inline unsigned int eventstate() const { return entity_eventstate; }
+ inline const int state() const { return entity_state; }
/// event state timer
- inline float timer() const { return entity_timer; }
+ inline const float timer() const { return entity_timer; }
/*----- serializers ----------------------------------------------- */
@@ -340,7 +340,7 @@ public:
virtual void receive_server_update(std::istream &is);
/// set event state
- virtual void set_eventstate(Event eventstate);
+ virtual void set_state(int state);
/// runs one game frame for the entity
/**
@@ -355,7 +355,7 @@ public:
protected:
float entity_timer;
- int entity_eventstate;
+ int entity_state;
};
@@ -375,7 +375,7 @@ public:
/*----- inspectors ------------------------------------------------ */
/// core type id
- virtual inline unsigned int type() const { return Entity::Controlable; }
+ virtual inline const unsigned int type() const { return Entity::Controlable; }
/// owner of this entity
inline Player *owner() const { return entity_owner; }
@@ -491,7 +491,7 @@ public:
/*----- inspectors ------------------------------------------------ */
/// core type id
- virtual inline unsigned int type() const { return Entity::Globe; }
+ virtual inline const unsigned int type() const { return Entity::Globe; }
std::string entity_texture;