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>2011-07-13 17:35:56 +0000
committerStijn Buys <ingar@osirion.org>2011-07-13 17:35:56 +0000
commit6c758fe1739fe10a1409f959b459ea556ae8164b (patch)
tree99fcc399148bd6ea59e9aca623cb20b860763718
parentf1cc3234bcd8fd4af140e0439db94c28bf08b06b (diff)
Forcefully removed docked ships from the bullet simulation.
-rw-r--r--src/game/base/ship.cc44
1 files changed, 43 insertions, 1 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index 51d111b..d148f19 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -115,6 +115,8 @@ void Ship::reset()
current_target_afterburner = 0.0f;
EntityControlable::reset();
+
+ body()->setDamping(ship_shipmodel->linear_damping(), ship_shipmodel->angular_damping());
}
void Ship::func_impulse() {
@@ -296,8 +298,48 @@ void Ship::set_state(int state)
{
EntityControlable::set_state(state);
- if (state != core::Entity::Docked)
+ if (state != core::Entity::Docked) {
ship_dock = 0;
+ } else if (body()) {
+ // FIXME this weird hack removes docked ships from the bullet simulation
+ // this should be moved into core:: together with the set_state() / reset() cycle
+ // The game module should not be bothered with this
+
+ if (entity_motionstate) {
+ delete entity_motionstate;
+ entity_motionstate = 0;
+ }
+
+ if (zone() && zone()->physics()) {
+ if (entity_actioninterface) {
+ entity_zone->physics()->removeAction(entity_actioninterface);
+ delete entity_actioninterface;
+ entity_actioninterface = 0;
+ }
+ entity_zone->physics()->removeRigidBody(body());
+ }
+
+ if (entity_collision_shape) {
+ delete entity_collision_shape;
+ entity_collision_shape = 0;
+ }
+
+ for (CollisionShapes::iterator sit = entity_collision_child_shapes.begin(); sit != entity_collision_child_shapes.end(); sit++) {
+ delete (*sit);
+ (*sit) = 0;
+ }
+ entity_collision_child_shapes.clear();
+
+ if (entity_body) {
+ delete entity_body;
+ entity_body = 0;
+ }
+
+ if (entity_body_info) {
+ delete entity_body_info;
+ entity_body_info = 0;
+ }
+ }
}
void Ship::set_dock(core::Entity *dock)