Clients inform server on wielded item
[oweals/minetest.git] / src / content_craft.cpp
index 069e68300b9bdf412c082a84b7aaa2fdc250c19e..481ea1a6304d26d328124fc67ab208b1c5dec55f 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]
@@ -412,6 +413,22 @@ 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);
+               }
+       }
+
        return NULL;
 }
 
@@ -446,7 +463,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,
@@ -472,7 +489,7 @@ void craft_set_creative_inventory(Player *player)
                CONTENT_IGNORE
        };
        
-       u8 *mip = material_items;
+       content_t *mip = material_items;
        for(u16 i=0; i<PLAYER_INVENTORY_SIZE; i++)
        {
                if(*mip == CONTENT_IGNORE)