diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-18 12:59:52 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-19 15:12:20 +0300 |
commit | 77f9d35e736eb7f0f6491b3c6cbe415a8e9ad3cf (patch) | |
tree | 16f67d44f5c359e0d8597502d220c4bd3e5625fb /src/flooritem.cpp | |
parent | 5d89861c7e83bb9232e11565159b1917052f1467 (diff) | |
download | plus-77f9d35e736eb7f0f6491b3c6cbe415a8e9ad3cf.tar.gz plus-77f9d35e736eb7f0f6491b3c6cbe415a8e9ad3cf.tar.bz2 plus-77f9d35e736eb7f0f6491b3c6cbe415a8e9ad3cf.tar.xz plus-77f9d35e736eb7f0f6491b3c6cbe415a8e9ad3cf.zip |
move virtual member calls from flooritem constuctor into postInit.
Diffstat (limited to 'src/flooritem.cpp')
-rw-r--r-- | src/flooritem.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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), @@ -53,8 +51,12 @@ FloorItem::FloorItem(const int id, const int itemId, const int x, const int y, 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<float>(x * map->getTileWidth() + mPos.x = static_cast<float>(mX * map->getTileWidth() + subX + mapTileSize / 2 - 8); - mPos.y = static_cast<float>(y * map->getTileHeight() + mPos.y = static_cast<float>(mY * map->getTileHeight() + subY + mapTileSize - 8); } else |