diff options
author | Kahrl <kahrl@gmx.net> | 2011-09-19 06:37:24 +0200 |
---|---|---|
committer | Kahrl <kahrl@gmx.net> | 2011-09-19 06:37:24 +0200 |
commit | 02726f00031c8ffadf5298b037b595372be202ef (patch) | |
tree | 3a4feaac018b62fe33bdc338a8e1c2d38ddaa376 /src/inventory.h | |
parent | 36bcbca9acabbc47976d3d7625ffb1c9396b8fdc (diff) | |
download | minetest-02726f00031c8ffadf5298b037b595372be202ef.tar.gz minetest-02726f00031c8ffadf5298b037b595372be202ef.tar.bz2 minetest-02726f00031c8ffadf5298b037b595372be202ef.zip |
Convert any inventory item into a mesh, bring back InventoryItem::getImageRay(), some const-correctness fixes
Diffstat (limited to 'src/inventory.h')
-rw-r--r-- | src/inventory.h | 24 |
1 files changed, 17 insertions, 7 deletions
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() { |