diff options
Diffstat (limited to 'src/flooritem.cpp')
-rw-r--r-- | src/flooritem.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/flooritem.cpp b/src/flooritem.cpp index c3442a86..e5a9d215 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -32,24 +32,17 @@ FloorItem::FloorItem(int id, int x, int y, Map *map): - mId(id), - mX(x), - mY(y), - mMap(map), - mAlpha(1.0f) + mId(id) { + setMap(map); + mPos.x = x * map->getTileWidth(); + mPos.y = y * map->getTileHeight(); // Create a corresponding item instance mItem = new Item(itemId); - - // Add ourselves to the map - mMapSprite = mMap->addSprite(this); } FloorItem::~FloorItem() { - // Remove ourselves from the map - mMap->removeSprite(mMapSprite); - delete mItem; } @@ -73,7 +66,7 @@ void FloorItem::draw(Graphics *graphics, int offsetX, int offsetY) const if (mAlpha != image->getAlpha()) image->setAlpha(mAlpha); - graphics->drawImage(image, mX * mMap->getTileWidth() + offsetX, - mY * mMap->getTileHeight() + offsetY); + graphics->drawImage(image, getPixelX() + offsetX, + getPixelY() + offsetY); } } |