summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-05 10:59:48 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-05 10:59:48 +0300
commitd6d811f97bc921b11da735fda15b07de180b298b (patch)
tree32d09f6763819253ac78901f236d5fb5396cc1ae /src/inventory.cpp
parentd1d57cf5c34c9a4626fd8e3b40db3ea321b40335 (diff)
downloadminetest-d6d811f97bc921b11da735fda15b07de180b298b.tar.gz
minetest-d6d811f97bc921b11da735fda15b07de180b298b.tar.bz2
minetest-d6d811f97bc921b11da735fda15b07de180b298b.zip
A more robust format for node metadata
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 86e00877c..ccd55a79f 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -91,6 +91,19 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is)
}
/*
+ MaterialItem
+*/
+
+InventoryItem *MaterialItem::createCookResult()
+{
+ if(m_content == CONTENT_TREE)
+ {
+ return new CraftItem("lump_of_coal", 1);
+ }
+ return NULL;
+}
+
+/*
MapBlockObjectItem
*/
#ifndef SERVER
@@ -313,6 +326,11 @@ u32 InventoryList::getUsedSlots()
return num;
}
+u32 InventoryList::getFreeSlots()
+{
+ return getSize() - getUsedSlots();
+}
+
InventoryItem * InventoryList::getItem(u32 i)
{
if(i > m_items.size() - 1)