From 2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 12 Jun 2008 09:06:01 +0000 Subject: Merged revisions 3738 via svnmerge from https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/trunk ........ r3738 | b_lindeijer | 2007-11-16 00:44:01 +0100 (Fri, 16 Nov 2007) | 3 lines Moved item icon from ItemInfo class to the Item class, so that it can be loaded on demand. Results in faster startup time and reduced memory usage. ........ --- src/floor_item.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/floor_item.cpp') diff --git a/src/floor_item.cpp b/src/floor_item.cpp index 5d83e1dd..9727093f 100644 --- a/src/floor_item.cpp +++ b/src/floor_item.cpp @@ -25,23 +25,18 @@ #include "map.h" -#include "resources/itemdb.h" -#include "resources/iteminfo.h" - - FloorItem::FloorItem(unsigned int id, unsigned int itemId, unsigned short x, unsigned short y, Map *map): mId(id), - mItemId(itemId), mX(x), mY(y), mMap(map) { - // Retrieve item image from item info - mImage = ItemDB::get(itemId).getImage(); + // Create a corresponding item instance + mItem = new Item(itemId); // Add ourselves to the map mSpriteIterator = mMap->addSprite(this); @@ -51,4 +46,6 @@ FloorItem::~FloorItem() { // Remove ourselves from the map mMap->removeSprite(mSpriteIterator); + + delete mItem; } -- cgit v1.2.3-70-g09d2