From 77f9d35e736eb7f0f6491b3c6cbe415a8e9ad3cf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Oct 2013 12:59:52 +0300 Subject: move virtual member calls from flooritem constuctor into postInit. --- src/flooritem.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/flooritem.cpp') diff --git a/src/flooritem.cpp b/src/flooritem.cpp index 81ffa67cc..f0679e55b 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -38,9 +38,7 @@ #include "debug.h" FloorItem::FloorItem(const int id, const int itemId, const int x, const int y, - Map *const map, const int amount, - const unsigned char color, - int subX, int subY): + const int amount, const unsigned char color) : ActorSprite(id), mItemId(itemId), mX(x), @@ -52,9 +50,13 @@ FloorItem::FloorItem(const int id, const int itemId, const int x, const int y, mColor(color), mShowMsg(true), mHighlight(config.getBoolValue("floorItemsHighlight")) +{ +} + +void FloorItem::postInit(Map *const map, int subX, int subY) { setMap(map); - const ItemInfo &info = ItemDB::get(itemId); + const ItemInfo &info = ItemDB::get(mItemId); if (map) { const int max = info.getMaxFloorOffset(); @@ -66,9 +68,9 @@ FloorItem::FloorItem(const int id, const int itemId, const int x, const int y, subY = max; else if (subY < -max) subY = -max; - mPos.x = static_cast(x * map->getTileWidth() + mPos.x = static_cast(mX * map->getTileWidth() + subX + mapTileSize / 2 - 8); - mPos.y = static_cast(y * map->getTileHeight() + mPos.y = static_cast(mY * map->getTileHeight() + subY + mapTileSize - 8); } else -- cgit v1.2.3-60-g2f50