From f2dbb7140f8efab0278ac17489b75c0c8ab60102 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 10 May 2009 19:34:42 +0200 Subject: Fixed the problem with items disappearing beneath the road Increased their pixel y coordinate by half a tile, to make them draw between the fringe and the beings. --- src/flooritem.h | 19 +++++++++++-------- src/gui/inventorywindow.cpp | 2 +- src/item.h | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/flooritem.h b/src/flooritem.h index 9911cd25..99074943 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -41,6 +41,12 @@ class FloorItem : public Sprite public: /** * Constructor. + * + * @param id the unique ID of this item instance + * @param itemId the item ID + * @param x the x position in tiles + * @param y the y position in tiles + * @param map the map this item is on */ FloorItem(int id, int itemId, @@ -48,18 +54,15 @@ class FloorItem : public Sprite int y, Map *map); - /** - * Destructor. - */ ~FloorItem(); /** - * Returns instance id of this item. + * Returns instance ID of this item. */ int getId() const { return mId; } /** - * Returns the item id. + * Returns the item ID. */ int getItemId() const; @@ -70,12 +73,12 @@ class FloorItem : public Sprite Item *getItem() const; /** - * Returns the x coordinate. + * Returns the x coordinate in tiles. */ int getX() const { return mX; } /** - * Returns the y coordinate. + * Returns the y coordinate in tiles. */ int getY() const { return mY; } @@ -84,7 +87,7 @@ class FloorItem : public Sprite * * @see Sprite::getPixelY() */ - int getPixelY() const { return mY * 32; } + int getPixelY() const { return mY * 32 + 16; } /** * Draws this floor item to the given graphics context. diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index a7be69b8..efa5bc2e 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -184,7 +184,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event) } } -Item* InventoryWindow::getSelectedItem() const +Item *InventoryWindow::getSelectedItem() const { return mItems->getSelectedItem(); } diff --git a/src/item.h b/src/item.h index 87a37e08..0e27aa4c 100644 --- a/src/item.h +++ b/src/item.h @@ -56,7 +56,7 @@ class Item /** * Returns the item image. */ - Image* getImage() { return mImage; } + Image *getImage() { return mImage; } /** * Sets the number of items. @@ -106,7 +106,7 @@ class Item /** * Returns information about this item type. */ - const ItemInfo& getInfo() const { return ItemDB::get(mId); } + const ItemInfo &getInfo() const { return ItemDB::get(mId); } protected: int mId; /**< Item type id. */ -- cgit v1.2.3-70-g09d2