From 8fbb2425220389ee69749ccd93407a0db73678fd Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 3 Mar 2012 23:15:39 +0000 Subject: Added core::Slots class template, replaced Entity::set_inventory() with Entity::add_inventory(). --- src/game/base/cargo.cc | 2 +- src/game/base/game.cc | 8 +++----- src/game/base/ship.cc | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src/game/base') diff --git a/src/game/base/cargo.cc b/src/game/base/cargo.cc index 7909e55..706bf84 100644 --- a/src/game/base/cargo.cc +++ b/src/game/base/cargo.cc @@ -375,7 +375,7 @@ void Cargo::eject(core::EntityControlable *ejector, const int amount) pod->set_info(item->info()); // add loot to inventory - pod->set_inventory(new core::Inventory()); + pod->add_inventory(); pod->inventory()->set_capacity(item->info()->volume() * negotiated_amount); core::Item *loot = new core::Item(item->info()); diff --git a/src/game/base/game.cc b/src/game/base/game.cc index 0610377..d8af507 100644 --- a/src/game/base/game.cc +++ b/src/game/base/game.cc @@ -1224,8 +1224,7 @@ bool Game::load_zone(core::Zone *zone) } else { inventory = entity->inventory(); if (!inventory) { - inventory = new core::Inventory(); - entity->set_inventory(inventory); + inventory = entity->add_inventory(); } } @@ -1238,11 +1237,10 @@ bool Game::load_zone(core::Zone *zone) zoneini.unknown_error("ship definition without entity"); } else if ((entity->moduletype() != planet_enttype) && (entity->moduletype() != station_enttype)) { zoneini.unknown_error("ship definition for invalid entity type"); - } else { + } else { inventory = entity->inventory(); if (!inventory) { - inventory = new core::Inventory(); - entity->set_inventory(inventory); + inventory = entity->add_inventory(); } } diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index e5ae2fe..9a6d02e 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -72,7 +72,7 @@ Ship::Ship(core::Player *owner, const ShipModel *shipmodel) : core::EntityContro set_label(str); // add an inventory - set_inventory(new core::Inventory()); + add_inventory(); inventory()->set_capacity(ship_shipmodel->maxcargo()); } -- cgit v1.2.3