Fix water-glass and water-lava surfaces
[oweals/minetest.git] / src / inventory.h
index f70d69b6d71a33116cb575058234fc25aacdfc4e..490cab73ef9eb239ae43241cbdf0954c998b0ea6 100644 (file)
@@ -29,7 +29,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include <string>
 #include "common_irrlicht.h"
 #include "debug.h"
-#include "mapblockobject.h"
 #include "main.h" // For g_materials
 #include "mapnode.h" // For content_t
 
@@ -54,11 +53,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 * getImageRaw() { return NULL; }
-       // Shall return an image to show in the GUI (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 ""; }
@@ -153,10 +152,9 @@ public:
                return new MaterialItem(m_content, m_count);
        }
 #ifndef SERVER
-       video::ITexture * getImage()
+       video::ITexture * getImage() const
        {
                return content_features(m_content).inventory_texture;
-               return NULL;
        }
 #endif
        std::string getText()
@@ -197,56 +195,6 @@ private:
        content_t m_content;
 };
 
-//TODO: Remove
-class MapBlockObjectItem : public InventoryItem
-{
-public:
-       MapBlockObjectItem(std::string inventorystring):
-               InventoryItem(1)
-       {
-               m_inventorystring = inventorystring;
-       }
-       
-       /*
-               Implementation interface
-       */
-       virtual const char* getName() const
-       {
-               return "MBOItem";
-       }
-       virtual void serialize(std::ostream &os) const
-       {
-               std::string sane_string(m_inventorystring);
-               str_replace_char(sane_string, '|', '?');
-               os<<getName();
-               os<<" ";
-               os<<sane_string;
-               os<<"|";
-       }
-       virtual InventoryItem* clone()
-       {
-               return new MapBlockObjectItem(m_inventorystring);
-       }
-
-#ifndef SERVER
-       video::ITexture * getImage();
-#endif
-       std::string getText();
-
-       /*
-               Special methods
-       */
-       std::string getInventoryString()
-       {
-               return m_inventorystring;
-       }
-
-       MapBlockObject * createObject(v3f pos, f32 player_yaw, f32 player_pitch);
-
-private:
-       std::string m_inventorystring;
-};
-
 /*
        An item that is used as a mid-product when crafting.
        Subnames:
@@ -280,7 +228,7 @@ public:
                return new CraftItem(m_subname, m_count);
        }
 #ifndef SERVER
-       video::ITexture * getImage();
+       video::ITexture * getImage() const;
 #endif
        std::string getText()
        {
@@ -357,7 +305,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")
@@ -388,23 +336,13 @@ public:
                        return "cloud.png";
 }
        
-       video::ITexture * getImageRaw()
-       {
-               if(g_texturesource == NULL)
-                       return NULL;
-               
-               return g_texturesource->getTextureRaw(getBasename());
-       }
-       
-       video::ITexture * getImage()
+       video::ITexture * getImage() const
        {
                if(g_texturesource == NULL)
                        return NULL;
                
                std::string basename = getBasename();
                
-               return g_texturesource->getTextureRaw(basename);
-               
                /*
                        Calculate a progress value with sane amount of
                        maximum states
@@ -418,6 +356,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()
        {