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>2012-03-03 23:15:39 +0000
committerStijn Buys <ingar@osirion.org>2012-03-03 23:15:39 +0000
commit8fbb2425220389ee69749ccd93407a0db73678fd (patch)
tree3ef7b7615711f9dd552760fbf0c26a801421082b /src/game/base
parentf0a4a7d7213b61714542d64a7559648a086df26a (diff)
Added core::Slots class template, replaced Entity::set_inventory() with Entity::add_inventory().
Diffstat (limited to 'src/game/base')
-rw-r--r--src/game/base/cargo.cc2
-rw-r--r--src/game/base/game.cc8
-rw-r--r--src/game/base/ship.cc2
3 files changed, 5 insertions, 7 deletions
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());
}