Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/base')
-rw-r--r--src/game/base/ship.cc58
1 files changed, 31 insertions, 27 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 84b4e0a..1298d05 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -1,3 +1,4 @@
+
/*
base/ship.cc
This file is part of the Osirion project and is distributed under
@@ -113,35 +114,37 @@ void Ship::reset()
EntityControlable::reset();
}
-void Ship::func_impulse()
-{
- if (entity_state == core::Entity::Impulse) {
- entity_state = core::Entity::Normal;
- target_thrust = 1.0f;
- entity_thrust = 0.0f;
- set_dirty();
- return;
- }
-
- if (entity_state == core::Entity::ImpulseInitiate) {
- entity_state = core::Entity::Normal;
- set_dirty();
- return;
- }
+void Ship::func_impulse() {
- if (entity_state == core::Entity::JumpInitiate) {
- entity_state = core::Entity::Normal;
- ship_jumpdrive_timer = 0;
- entity_timer = 0;
- set_dirty();
+ switch (entity_state) {
+ case core::Entity::Impulse:
+ entity_state = core::Entity::Normal;
+ target_thrust = 1.0f;
+ entity_thrust = 0.0f;
+ set_dirty();
+ break;
+
+ case core::Entity::ImpulseInitiate:
+ entity_state = core::Entity::Normal;
+ set_dirty();
+ break;
+
+ case core::Entity::JumpInitiate:
+ entity_state = core::Entity::Normal;
+ ship_jumpdrive_timer = 0;
+ entity_timer = 0;
+ set_dirty();
+ break;
+
+ case core::Entity::Normal:
+ entity_state = core::Entity::ImpulseInitiate;
+ entity_timer = impulse_timer_delay;
+ ship_impulsedrive_timer = core::server()->time();
+ break;
+
+ default:
+ break;
}
-
- if (entity_state != core::Entity::Normal)
- return;
-
- entity_state = core::Entity::ImpulseInitiate;
- entity_timer = impulse_timer_delay;
- ship_impulsedrive_timer = core::server()->time();
}
@@ -309,6 +312,7 @@ void Ship::action (btScalar seconds)
maxspeed = 0.0f;
engine_force = 0.0f;
break;
+
case core::Entity::Docked:
maxspeed = 0.0f;
engine_force = 0.0f;