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/core/entity.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index 4a6528f..2f23444 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -271,12 +271,12 @@ void Entity::set_info(const Info *info) entity_info = info; } -void Entity::set_inventory(Inventory *inventory) +Inventory *Entity::add_inventory() { - if (entity_inventory && (entity_inventory != inventory)) { - delete entity_inventory; - } - entity_inventory = inventory; + if (!entity_inventory) { + entity_inventory = new Inventory(); + } + return(entity_inventory); } void Entity::set_zone(Zone *zone) -- cgit v1.2.3