From 5a4d8ffad3b172eae67844deda6b65273b7c9757 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 10 Apr 2011 15:16:27 +0300 Subject: implemented rats in new system to verify that it works --- src/inventory.h | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) (limited to 'src/inventory.h') diff --git a/src/inventory.h b/src/inventory.h index 761e664a9..3ba655880 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -35,6 +35,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #define QUANTITY_ITEM_MAX_COUNT 99 +class ServerActiveObject; +class ServerEnvironment; + class InventoryItem { public: @@ -54,6 +57,12 @@ public: #endif // Shall return a text to show in the GUI virtual std::string getText() { return ""; } + // Creates an object from the item, to be placed in the world. + virtual ServerActiveObject* createSAO(ServerEnvironment *env, u16 id, v3f pos); + + /* + Quantity methods + */ // Shall return true if the item can be add()ed to the other virtual bool addableTo(InventoryItem *other) @@ -61,9 +70,6 @@ public: return false; } - /* - Quantity methods - */ u16 getCount() { return m_count; @@ -175,6 +181,7 @@ private: u8 m_content; }; +//TODO: Remove class MapBlockObjectItem : public InventoryItem { public: @@ -262,28 +269,7 @@ public: return new CraftItem(m_subname, m_count); } #ifndef SERVER - video::ITexture * getImage() - { - if(g_texturesource == NULL) - return NULL; - - std::string name; - - if(m_subname == "Stick") - name = "stick.png"; - else if(m_subname == "lump_of_coal") - name = "lump_of_coal.png"; - else if(m_subname == "lump_of_iron") - name = "lump_of_iron.png"; - else if(m_subname == "steel_ingot") - name = "steel_ingot.png"; - else - name = "cloud.png"; - - // Get such a texture - //return g_irrlicht->getTexture(name); - return g_texturesource->getTextureRaw(name); - } + video::ITexture * getImage(); #endif std::string getText() { @@ -291,6 +277,9 @@ public: os<getName()) != "CraftItem") -- cgit v1.2.3