From 02726f00031c8ffadf5298b037b595372be202ef Mon Sep 17 00:00:00 2001 From: Kahrl Date: Mon, 19 Sep 2011 06:37:24 +0200 Subject: Convert any inventory item into a mesh, bring back InventoryItem::getImageRay(), some const-correctness fixes --- src/inventory.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src/inventory.h') diff --git a/src/inventory.h b/src/inventory.h index 4aa68d99e..3e05015ef 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -54,9 +54,11 @@ public: virtual InventoryItem* clone() = 0; #ifndef SERVER // Return the name of the image for this item - virtual std::string getBasename() { return ""; } + virtual std::string getBasename() const { return ""; } // Shall return an image of the item (or NULL) - virtual video::ITexture * getImage() { return NULL; } + virtual video::ITexture * getImage() const { return NULL; } + // Shall return an image of the item without embellishments (or NULL) + virtual video::ITexture * getImageRaw() const { return getImage(); } #endif // Shall return a text to show in the GUI virtual std::string getText() { return ""; } @@ -151,7 +153,7 @@ public: return new MaterialItem(m_content, m_count); } #ifndef SERVER - video::ITexture * getImage() + video::ITexture * getImage() const { return content_features(m_content).inventory_texture; } @@ -226,7 +228,7 @@ public: } #ifndef SERVER - video::ITexture * getImage(); + video::ITexture * getImage() const; #endif std::string getText(); @@ -277,7 +279,7 @@ public: return new CraftItem(m_subname, m_count); } #ifndef SERVER - video::ITexture * getImage(); + video::ITexture * getImage() const; #endif std::string getText() { @@ -354,7 +356,7 @@ public: return new ToolItem(m_toolname, m_wear); } #ifndef SERVER - std::string getBasename() { + std::string getBasename() const { if(m_toolname == "WPick") return "tool_woodpick.png"; else if(m_toolname == "STPick") @@ -385,7 +387,7 @@ public: return "cloud.png"; } - video::ITexture * getImage() + video::ITexture * getImage() const { if(g_texturesource == NULL) return NULL; @@ -405,6 +407,14 @@ public: return g_texturesource->getTextureRaw(os.str()); } + + video::ITexture * getImageRaw() const + { + if(g_texturesource == NULL) + return NULL; + + return g_texturesource->getTextureRaw(getBasename()); + } #endif std::string getText() { -- cgit v1.2.3