]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/inventory.cpp
+ paper, book, bookshelf
[dragonfireclient.git] / src / inventory.cpp
index b14828ae22ba3250c9aee688cee40c4434a38137..cb398a537527a436c968953a866a6591bfd06a7e 100644 (file)
@@ -118,6 +118,10 @@ bool MaterialItem::isCookable()
        {
                return true;
        }
+       else if(m_content == CONTENT_SAND)
+       {
+               return true;
+       }
        return false;
 }
 
@@ -131,6 +135,10 @@ InventoryItem *MaterialItem::createCookResult()
        {
                return new MaterialItem(CONTENT_STONE, 1);
        }
+       else if(m_content == CONTENT_SAND)
+       {
+               return new MaterialItem(CONTENT_GLASS, 1);
+       }
        return NULL;
 }
 
@@ -148,19 +156,26 @@ video::ITexture * CraftItem::getImage()
 
        if(m_subname == "Stick")
                name = "stick.png";
+       else if(m_subname == "paper")
+               name = "paper.png";
+       else if(m_subname == "book")
+               name = "book.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 == "lump_of_clay")
+               name = "lump_of_clay.png";
        else if(m_subname == "steel_ingot")
                name = "steel_ingot.png";
+       else if(m_subname == "clay_brick")
+               name = "clay_brick.png";
        else if(m_subname == "rat")
                name = "rat.png";
        else
                name = "cloud.png";
        
        // Get such a texture
-       //return g_irrlicht->getTexture(name);
        return g_texturesource->getTextureRaw(name);
 }
 #endif
@@ -180,9 +195,19 @@ ServerActiveObject* CraftItem::createSAO(ServerEnvironment *env, u16 id, v3f pos
        }
 }
 
+u16 CraftItem::getDropCount()
+{
+       // Special cases
+       if(m_subname == "rat")
+               return 1;
+       // Default
+       else
+               return InventoryItem::getDropCount();
+}
+
 bool CraftItem::isCookable()
 {
-       if(m_subname == "lump_of_iron")
+       if(m_subname == "lump_of_iron" || m_subname == "lump_of_clay")
        {
                return true;
        }
@@ -195,6 +220,8 @@ InventoryItem *CraftItem::createCookResult()
        {
                return new CraftItem("steel_ingot", 1);
        }
+       else if(m_subname == "lump_of_clay")
+               return new CraftItem("clay_brick", 1);
        return NULL;
 }
 
@@ -278,6 +305,7 @@ InventoryList::InventoryList(std::string name, u32 size)
        m_name = name;
        m_size = size;
        clearItems();
+       //m_dirty = false;
 }
 
 InventoryList::~InventoryList()
@@ -303,6 +331,8 @@ void InventoryList::clearItems()
        {
                m_items.push_back(NULL);
        }
+
+       //setDirty(true);
 }
 
 void InventoryList::serialize(std::ostream &os)
@@ -396,6 +426,7 @@ InventoryList & InventoryList::operator = (const InventoryList &other)
                        m_items[i] = item->clone();
                }
        }
+       //setDirty(true);
 
        return *this;
 }
@@ -440,6 +471,7 @@ InventoryItem * InventoryList::changeItem(u32 i, InventoryItem *newitem)
 
        InventoryItem *olditem = m_items[i];
        m_items[i] = newitem;
+       //setDirty(true);
        return olditem;
 }
 
@@ -493,6 +525,8 @@ InventoryItem * InventoryList::addItem(u32 i, InventoryItem *newitem)
        if(newitem == NULL)
                return NULL;
        
+       //setDirty(true);
+       
        // If it is an empty position, it's an easy job.
        InventoryItem *to_item = m_items[i];
        if(to_item == NULL)
@@ -549,6 +583,8 @@ InventoryItem * InventoryList::takeItem(u32 i, u32 count)
 {
        if(count == 0)
                return NULL;
+       
+       //setDirty(true);
 
        InventoryItem *item = m_items[i];
        // If it is an empty position, return NULL