diff options
Diffstat (limited to 'src/game/base/cargo.cc')
-rw-r--r-- | src/game/base/cargo.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/game/base/cargo.cc b/src/game/base/cargo.cc index cc358f6..3571b22 100644 --- a/src/game/base/cargo.cc +++ b/src/game/base/cargo.cc @@ -330,7 +330,7 @@ void Cargo::eject(core::EntityControlable *ejector, const int amount) } item->dec_amount(negotiated_amount); - ejector->owner()->set_dirty(); + ejector->inventory()->set_dirty(); if (!ejector->state() == core::Entity::Docked) { std::stringstream msgstr; @@ -342,8 +342,7 @@ void Cargo::eject(core::EntityControlable *ejector, const int amount) return; } - // create cargo pod - + // create cargo pod CargoPod *pod = new CargoPod(); pod->set_color(ejector->color()); @@ -351,10 +350,15 @@ void Cargo::eject(core::EntityControlable *ejector, const int amount) pod->set_zone(ejector->zone()); pod->set_location(ejector->location() + ejector->axis().up() * ejector->radius()); pod->set_axis(ejector->axis()); - + + // add loot to inventory pod->set_inventory(new core::Inventory()); pod->inventory()->set_capacity(item->info()->volume() * negotiated_amount); - pod->inventory()->add(new core::Item(*item)); + + core::Item *loot = new core::Item(item->info()); + loot->set_amount(negotiated_amount); + + pod->inventory()->add(loot); pod->inventory()->set_dirty(); if (ejector->owner()) { |