From 208c13a72d72ab2aea08e79d8862e41c63fd1037 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Fri, 15 Oct 2010 22:39:04 +0000 Subject: destroy cargo when ejecting while docked --- src/game/base/cargo.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/base/cargo.cc b/src/game/base/cargo.cc index 3571b22..1a933e8 100644 --- a/src/game/base/cargo.cc +++ b/src/game/base/cargo.cc @@ -306,6 +306,13 @@ void Cargo::eject(core::EntityControlable *ejector, const int amount) return; } + if ((ejector->state() == core::Entity::Jump) || (ejector->state() == core::Entity::JumpInitiate)) { + if (ejector->owner()) { + ejector->owner()->send("^WCan not eject while hyperspace jump drive is active"); + } + return; + } + // find the cargo in the inventory core::Item *item = ejector->inventory()->find(this); if (!item || !item->amount()) { @@ -332,7 +339,7 @@ void Cargo::eject(core::EntityControlable *ejector, const int amount) item->dec_amount(negotiated_amount); ejector->inventory()->set_dirty(); - if (!ejector->state() == core::Entity::Docked) { + if (ejector->state() == core::Entity::Docked) { std::stringstream msgstr; if (ejector->owner()) { msgstr << "^BDestroyed " << negotiated_amount << " " << aux::plural("unit", negotiated_amount) << " of " << name(); -- cgit v1.2.3