diff options
Diffstat (limited to 'src/floor_item.cpp')
-rwxr-xr-x | src/floor_item.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/floor_item.cpp b/src/floor_item.cpp index a1b83a75..32b8aee5 100755 --- a/src/floor_item.cpp +++ b/src/floor_item.cpp @@ -46,23 +46,16 @@ FloorItem::FloorItem(unsigned int id, mMap(map) { // Retrieve item image using a global itemset and itemDb (alternative?) - Image *image = itemset->spriteset[ - itemDb->getItemInfo(itemId)->getImage() - 1]; + mImage = itemset->spriteset[itemDb->getItemInfo(itemId)->getImage() - 1]; - // Create the sprite representing this floor item - mSprite = new Sprite(mX * map->getTileWidth(), - mY * map->getTileHeight(), - image); - - // Add the representative sprite to the map - mSpriteIterator = mMap->addSprite(mSprite); + // Add ourselves to the map + mSpriteIterator = mMap->addSprite(this); } FloorItem::~FloorItem() { // Remove and delete the representative sprite mMap->removeSprite(mSpriteIterator); - delete mSprite; } void empty_floor_items() |