diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-04-05 18:23:30 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-04-05 18:23:30 +0300 |
commit | 89aa8b9be1fbe3659d0bfb9263cf1c563044c04e (patch) | |
tree | 643801781f44b395dab1f50a9cbd588dab425d79 /src/inventory.cpp | |
parent | 5b4928e07c8bcc877bfc2a8c0268ea9601cf699b (diff) | |
download | minetest-89aa8b9be1fbe3659d0bfb9263cf1c563044c04e.tar.gz minetest-89aa8b9be1fbe3659d0bfb9263cf1c563044c04e.tar.bz2 minetest-89aa8b9be1fbe3659d0bfb9263cf1c563044c04e.zip |
Furnace is now usable. Added more tools.
--HG--
rename : data/tool_stpick.png => data/tool_stonepick.png
rename : data/tool_wpick.png => data/tool_woodpick.png
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index ccd55a79f..f9b9107a0 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -94,12 +94,51 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is) MaterialItem */ +bool MaterialItem::isCookable() +{ + if(m_content == CONTENT_TREE) + { + return true; + } + else if(m_content == CONTENT_COBBLE) + { + return true; + } + return false; +} + InventoryItem *MaterialItem::createCookResult() { if(m_content == CONTENT_TREE) { return new CraftItem("lump_of_coal", 1); } + else if(m_content == CONTENT_COBBLE) + { + return new MaterialItem(CONTENT_STONE, 1); + } + return NULL; +} + +/* + CraftItem +*/ + +bool CraftItem::isCookable() +{ + if(m_subname == "lump_of_iron") + { + return true; + } + return false; +} + +InventoryItem *CraftItem::createCookResult() +{ + if(m_subname == "lump_of_iron") + { + return new CraftItem("steel_ingot", 1); + } return NULL; } @@ -357,6 +396,9 @@ void InventoryList::deleteItem(u32 i) InventoryItem * InventoryList::addItem(InventoryItem *newitem) { + if(newitem == NULL) + return NULL; + /* First try to find if it could be added to some existing items */ @@ -391,6 +433,9 @@ InventoryItem * InventoryList::addItem(InventoryItem *newitem) InventoryItem * InventoryList::addItem(u32 i, InventoryItem *newitem) { + if(newitem == NULL) + return NULL; + // If it is an empty position, it's an easy job. InventoryItem *to_item = m_items[i]; if(to_item == NULL) |