diff options
Diffstat (limited to 'src/game/base/ship.cc')
-rw-r--r-- | src/game/base/ship.cc | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index 4a77706..6c5598e 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -25,8 +25,6 @@ using math::degrees180f; namespace game { -const float MIN_DELTA = 0.000001f; - Ship::Ship(core::Player *owner, const ShipModel *shipmodel) : core::EntityControlable() { assert(shipmodel); @@ -207,16 +205,22 @@ void Ship::func_jump(std::string const &args) helpstr.append("^N|^B"); helpstr.append((*it).second->label()); } - owner()->send("Usage: jump [^B" + helpstr + "^N]"); + if (owner()) { + owner()->send("Usage: jump [^B" + helpstr + "^N]"); + } return; } if (jumptargetzone == zone()) { - owner()->send("Already in the " + jumptargetzone->name()); + if (owner()) { + owner()->send("Already in the " + jumptargetzone->name()); + } return; } - owner()->send("Jumping to the " + jumptargetzone->name()); + if (owner()) { + owner()->send("Jumping to the " + jumptargetzone->name()); + } set_zone(jumptargetzone); //ship_jumpdrive_timer = 0; @@ -233,14 +237,18 @@ void Ship::func_jump(std::string const &args) } else { if (!jumpdrive() && !Game::g_devel->value()) { - owner()->send("This ship is not equiped with a hyperspace drive!"); + if (owner()) { + owner()->send("This ship is not equiped with a hyperspace drive!"); + } return; } else if (entity_state == core::Entity::Jump) { return; } else if (entity_state == core::Entity::JumpInitiate) { - owner()->send("Jump aborted, hyperspace drive deactivated"); + if (owner()) { + owner()->send("Jump aborted, hyperspace drive deactivated"); + } ship_jumpdrive_timer = 0; entity_timer = 0; entity_state = core::Entity::Normal; @@ -269,14 +277,20 @@ JumpPoint * Ship::find_closest_jumppoint() if (jumppoint && jumppoint->target()) { if (Game::g_jumppointrange->value() < d) { - owner()->send("Jumppoint out of range!"); + if (owner()) { + owner()->send("Jumppoint out of range!"); + } return 0; } else { - owner()->send("Jumping to the " + jumppoint->target()->zone()->name()); + if (owner()) { + owner()->send("Jumping to the " + jumppoint->target()->zone()->name()); + } return jumppoint; } } else { - owner()->send("No jumppoints found!"); + if (owner()) { + owner()->send("No jumppoints found!"); + } return 0; } @@ -299,8 +313,9 @@ void Ship::explode() entity_thrust = 0; if (owner()) { - if (owner()->control() == this) + if (owner()->control() == this) { owner()->set_view(this); + } } }; |