utility.h: Change Buffer's interface to be more compatible with SharedBuffer's interf...
[oweals/minetest.git] / src / content_craft.cpp
index 069e68300b9bdf412c082a84b7aaa2fdc250c19e..866c1e5328e07bbc02eab363f40aefa6c3f43f5d 100644 (file)
@@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "inventory.h"
 #include "content_mapnode.h"
 #include "player.h"
+#include "mapnode.h" // For content_t
 
 /*
        items: actually *items[9]
@@ -296,6 +297,24 @@ InventoryItem *craft_get_result(InventoryItem **items)
                }
        }
 
+       // Locking Chest
+       {
+               ItemSpec specs[9];
+               specs[0] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD);
+               specs[1] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD);
+               specs[2] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD);
+               specs[3] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD);
+               specs[4] = ItemSpec(ITEM_CRAFT, "steel_ingot");
+               specs[5] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD);
+               specs[6] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD);
+               specs[7] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD);
+               specs[8] = ItemSpec(ITEM_MATERIAL, CONTENT_WOOD);
+               if(checkItemCombination(items, specs))
+               {
+                       return new MaterialItem(CONTENT_LOCKABLE_CHEST, 1);
+               }
+       }
+
        // Furnace
        {
                ItemSpec specs[9];
@@ -412,6 +431,36 @@ InventoryItem *craft_get_result(InventoryItem **items)
                }
        }
 
+       // Ladder
+       {
+               ItemSpec specs[9];
+               specs[0] = ItemSpec(ITEM_CRAFT, "Stick");
+               specs[2] = ItemSpec(ITEM_CRAFT, "Stick");
+               specs[3] = ItemSpec(ITEM_CRAFT, "Stick");
+               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
+               specs[5] = ItemSpec(ITEM_CRAFT, "Stick");
+               specs[6] = ItemSpec(ITEM_CRAFT, "Stick");
+               specs[8] = ItemSpec(ITEM_CRAFT, "Stick");
+               if(checkItemCombination(items, specs))
+               {
+                       return new MaterialItem(CONTENT_LADDER, 1);
+               }
+       }
+       
+       // Iron Apple
+       {
+               ItemSpec specs[9];
+               specs[1] = ItemSpec(ITEM_CRAFT, "steel_ingot");
+               specs[3] = ItemSpec(ITEM_CRAFT, "steel_ingot");
+               specs[4] = ItemSpec(ITEM_CRAFT, "apple");
+               specs[5] = ItemSpec(ITEM_CRAFT, "steel_ingot");
+               specs[7] = ItemSpec(ITEM_CRAFT, "steel_ingot");
+               if(checkItemCombination(items, specs))
+               {
+                       return new CraftItem("apple_iron", 1);
+               }
+       }
+
        return NULL;
 }
 
@@ -446,7 +495,7 @@ void craft_set_creative_inventory(Player *player)
        */
        
        // CONTENT_IGNORE-terminated list
-       u8 material_items[] = {
+       content_t material_items[] = {
                CONTENT_TORCH,
                CONTENT_COBBLE,
                CONTENT_MUD,
@@ -469,10 +518,11 @@ void craft_set_creative_inventory(Player *player)
                CONTENT_CHEST,
                CONTENT_FURNACE,
                CONTENT_SIGN_WALL,
+               CONTENT_LAVASOURCE,
                CONTENT_IGNORE
        };
        
-       u8 *mip = material_items;
+       content_t *mip = material_items;
        for(u16 i=0; i<PLAYER_INVENTORY_SIZE; i++)
        {
                if(*mip == CONTENT_IGNORE)