From 5ddb64795cc959916eeedbec8dc3f65c06f49698 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 12 Nov 2009 20:53:35 +0000 Subject: initial commodities and entity inventory, bump network proto version to 18 --- src/core/entity.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index ce313e6..d01d825 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -114,6 +114,9 @@ Entity::Entity(const unsigned int flags) : entity_visible = true; entity_serverside = false; + + entity_inventory = 0; + entity_info = 0; memset(entity_extension, 0, sizeof(entity_extension)); @@ -133,6 +136,9 @@ Entity::Entity(std::istream & is) entity_created = true; entity_destroyed = false; + + entity_inventory = 0; + entity_info = 0; memset(entity_extension, 0, sizeof(entity_extension)); } @@ -151,6 +157,10 @@ Entity::~Entity() delete(*it); } menus().clear(); + + // delete inventory + if (entity_inventory) + delete entity_inventory; if (entity_zone) entity_zone->remove(this); @@ -168,6 +178,19 @@ void Entity::clear_updates() entity_oldzone = 0; } +void Entity::set_info(Info *info) +{ + entity_info = info; +} + +void Entity::set_inventory(Inventory *inventory) +{ + if (entity_inventory && (entity_inventory != inventory)) { + delete entity_inventory; + } + entity_inventory = inventory; +} + void Entity::set_zone(Zone *zone) { if (entity_zone == zone) -- cgit v1.2.3