Remove crafting definitions from content_craft.cpp
authorPerttu Ahola <celeron55@gmail.com>
Thu, 17 Nov 2011 08:19:31 +0000 (10:19 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Tue, 29 Nov 2011 17:13:48 +0000 (19:13 +0200)
src/content_craft.cpp
src/content_craft.h

index 188e3e4726d0b49ee7685ce21cb78ea77931a0c1..6a5052eea2e4b2cdc7ffadb4af1e8dc7f2c2edc7 100644 (file)
@@ -24,451 +24,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mapnode.h" // For content_t
 #include "gamedef.h"
 
-/*
-       items: actually *items[9]
-       return value: allocates a new item, or returns NULL.
-
-       NOTE: Not used anymore; TODO: Remove
-*/
-InventoryItem *craft_get_result(InventoryItem **items, IGameDef *gamedef)
-{
-       INodeDefManager *ndef = gamedef->ndef();
-
-       // Wood
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_TREE"));
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_WOOD"), 4);
-               }
-       }
-
-       // Stick
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               if(checkItemCombination(items, specs))
-               {
-                       return new CraftItem(gamedef, "Stick", 4);
-               }
-       }
-
-       // Fence
-       {
-               ItemSpec specs[9];
-               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[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[8] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_FENCE"), 2);
-               }
-       }
-
-       // Sign
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[2] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[3] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[4] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[5] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       //return new MapBlockObjectItem(gamedef, "Sign");
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_SIGN_WALL"), 1);
-               }
-       }
-
-       // Torch
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_CRAFT, "lump_of_coal");
-               specs[3] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_TORCH"), 4);
-               }
-       }
-
-       // Wooden pick
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[2] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "WPick", 0);
-               }
-       }
-
-       // Stone pick
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[2] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "STPick", 0);
-               }
-       }
-
-       // Steel pick
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[1] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[2] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "SteelPick", 0);
-               }
-       }
-
-       // Mese pick
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_MESE"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_MESE"));
-               specs[2] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_MESE"));
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "MesePick", 0);
-               }
-       }
-
-       // Wooden shovel
-       {
-               ItemSpec specs[9];
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "WShovel", 0);
-               }
-       }
-
-       // Stone shovel
-       {
-               ItemSpec specs[9];
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "STShovel", 0);
-               }
-       }
-
-       // Steel shovel
-       {
-               ItemSpec specs[9];
-               specs[1] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "SteelShovel", 0);
-               }
-       }
-
-       // Wooden axe
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[3] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "WAxe", 0);
-               }
-       }
-
-       // Stone axe
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[3] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "STAxe", 0);
-               }
-       }
-
-       // Steel axe
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[1] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[3] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "SteelAxe", 0);
-               }
-       }
-
-       // Wooden sword
-       {
-               ItemSpec specs[9];
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[4] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "WSword", 0);
-               }
-       }
-
-       // Stone sword
-       {
-               ItemSpec specs[9];
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[4] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "STSword", 0);
-               }
-       }
-
-       // Steel sword
-       {
-               ItemSpec specs[9];
-               specs[1] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[4] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new ToolItem(gamedef, "SteelSword", 0);
-               }
-       }
-
-       // Rail
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[1] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[2] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[3] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[4] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[5] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[6] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[7] = ItemSpec(ITEM_CRAFT, "Stick");
-               specs[8] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_RAIL"), 15);
-               }
-       }
-
-       // Chest
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[2] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[3] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[5] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[6] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[7] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[8] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_CHEST"), 1);
-               }
-       }
-
-       // Locking Chest
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[2] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[3] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[4] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[5] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[6] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[7] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[8] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_LOCKABLE_CHEST"), 1);
-               }
-       }
-
-       // Furnace
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[2] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[3] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[5] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[6] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[7] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               specs[8] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_COBBLE"));
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_FURNACE"), 1);
-               }
-       }
-
-       // Steel block
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[1] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[2] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[3] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[4] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[5] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[6] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[7] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               specs[8] = ItemSpec(ITEM_CRAFT, "steel_ingot");
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_STEEL"), 1);
-               }
-       }
-
-       // Sandstone
-       {
-               ItemSpec specs[9];
-               specs[3] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_SAND"));
-               specs[4] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_SAND"));
-               specs[6] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_SAND"));
-               specs[7] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_SAND"));
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_SANDSTONE"), 1);
-               }
-       }
-
-       // Clay
-       {
-               ItemSpec specs[9];
-               specs[3] = ItemSpec(ITEM_CRAFT, "lump_of_clay");
-               specs[4] = ItemSpec(ITEM_CRAFT, "lump_of_clay");
-               specs[6] = ItemSpec(ITEM_CRAFT, "lump_of_clay");
-               specs[7] = ItemSpec(ITEM_CRAFT, "lump_of_clay");
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_CLAY"), 1);
-               }
-       }
-
-       // Brick
-       {
-               ItemSpec specs[9];
-               specs[3] = ItemSpec(ITEM_CRAFT, "clay_brick");
-               specs[4] = ItemSpec(ITEM_CRAFT, "clay_brick");
-               specs[6] = ItemSpec(ITEM_CRAFT, "clay_brick");
-               specs[7] = ItemSpec(ITEM_CRAFT, "clay_brick");
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_BRICK"), 1);
-               }
-       }
-
-       // Paper
-       {
-               ItemSpec specs[9];
-               specs[3] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_PAPYRUS"));
-               specs[4] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_PAPYRUS"));
-               specs[5] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_PAPYRUS"));
-               if(checkItemCombination(items, specs))
-               {
-                       return new CraftItem(gamedef, "paper", 1);
-               }
-       }
-
-       // Book
-       {
-               ItemSpec specs[9];
-               specs[1] = ItemSpec(ITEM_CRAFT, "paper");
-               specs[4] = ItemSpec(ITEM_CRAFT, "paper");
-               specs[7] = ItemSpec(ITEM_CRAFT, "paper");
-               if(checkItemCombination(items, specs))
-               {
-                       return new CraftItem(gamedef, "book", 1);
-               }
-       }
-
-       // Book shelf
-       {
-               ItemSpec specs[9];
-               specs[0] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[1] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[2] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[3] = ItemSpec(ITEM_CRAFT, "book");
-               specs[4] = ItemSpec(ITEM_CRAFT, "book");
-               specs[5] = ItemSpec(ITEM_CRAFT, "book");
-               specs[6] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[7] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               specs[8] = ItemSpec(ITEM_MATERIAL, LEGN(ndef, "CONTENT_WOOD"));
-               if(checkItemCombination(items, specs))
-               {
-                       return new MaterialItem(gamedef, LEGN(ndef, "CONTENT_BOOKSHELF"), 1);
-               }
-       }
-
-       // 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(gamedef, LEGN(ndef, "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(gamedef, "apple_iron", 1);
-               }
-       }
-
-       return NULL;
-}
-
 void craft_set_creative_inventory(Player *player, IGameDef *gamedef)
 {
        INodeDefManager *ndef = gamedef->ndef();
index 9cffbe4aa5ce6540cbdda14a9086a638dc975a71..e7ff861eb91622dbd139d75f7fa979ea0b99df76 100644 (file)
@@ -24,12 +24,6 @@ class InventoryItem;
 class Player;
 class IGameDef;
 
-/*
-       items: actually *items[9]
-       return value: allocates a new item, or returns NULL.
-*/
-InventoryItem *craft_get_result(InventoryItem **items, IGameDef *gamedef);
-
 void craft_set_creative_inventory(Player *player, IGameDef *gamedef);
 
 // Called when give_initial_stuff setting is used