diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-04-05 10:59:48 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-04-05 10:59:48 +0300 |
commit | d6d811f97bc921b11da735fda15b07de180b298b (patch) | |
tree | 32d09f6763819253ac78901f236d5fb5396cc1ae /src/inventory.cpp | |
parent | d1d57cf5c34c9a4626fd8e3b40db3ea321b40335 (diff) | |
download | minetest-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.cpp | 18 |
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) |