Remove AUTO_VAR macro and _toString function (#592)
This commit is contained in:
@@ -30,7 +30,7 @@ void Recipes::_init()
|
||||
recipies = new RecipyList();
|
||||
}
|
||||
|
||||
Recipes::Recipes()
|
||||
Recipes::Recipes()
|
||||
{
|
||||
int iCount=0;
|
||||
_init();
|
||||
@@ -40,7 +40,7 @@ Recipes::Recipes()
|
||||
pFoodRecipies = new FoodRecipies;
|
||||
pOreRecipies = new OreRecipies;
|
||||
pStructureRecipies = new StructureRecipies;
|
||||
pToolRecipies = new ToolRecipies;
|
||||
pToolRecipies = new ToolRecipies;
|
||||
pWeaponRecipies = new WeaponRecipies;
|
||||
|
||||
// 4J Stu - These just don't work with our crafting menu
|
||||
@@ -64,8 +64,8 @@ Recipes::Recipes()
|
||||
L"#", //
|
||||
|
||||
L'#', new ItemInstance(Tile::treeTrunk, 1, TreeTile::BIRCH_TRUNK),
|
||||
L'S');
|
||||
|
||||
L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::wood, 4, TreeTile::DARK_TRUNK), //
|
||||
L"sczg",
|
||||
L"#", //
|
||||
@@ -89,7 +89,7 @@ Recipes::Recipes()
|
||||
L'S');
|
||||
|
||||
pToolRecipies->addRecipes(this);
|
||||
pFoodRecipies->addRecipes(this);
|
||||
pFoodRecipies->addRecipes(this);
|
||||
pStructureRecipies->addRecipes(this);
|
||||
|
||||
|
||||
@@ -136,8 +136,8 @@ Recipes::Recipes()
|
||||
L"#W#", //
|
||||
|
||||
L'#', Item::stick, L'W', Tile::wood,
|
||||
L'S');
|
||||
|
||||
L'S');
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::fence, 2), //
|
||||
L"sscig",
|
||||
L"###", //
|
||||
@@ -145,7 +145,7 @@ Recipes::Recipes()
|
||||
|
||||
L'#', Item::stick,
|
||||
L'S');
|
||||
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::netherFence, 6), //
|
||||
L"ssctg",
|
||||
L"###", //
|
||||
@@ -293,10 +293,10 @@ Recipes::Recipes()
|
||||
L'#', Tile::quartzBlock,
|
||||
L'S');
|
||||
|
||||
pArmorRecipes->addRecipes(this);
|
||||
pArmorRecipes->addRecipes(this);
|
||||
//iCount=getRecipies()->size();
|
||||
|
||||
pClothDyeRecipes->addRecipes(this);
|
||||
pClothDyeRecipes->addRecipes(this);
|
||||
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::snow, 1), //
|
||||
@@ -360,14 +360,14 @@ Recipes::Recipes()
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::stone,
|
||||
L'S');
|
||||
L'S');
|
||||
addShapedRecipy(new ItemInstance(Tile::stoneSlabHalf, 6, StoneSlabTile::COBBLESTONE_SLAB), //
|
||||
L"sctg",
|
||||
L"###", //
|
||||
|
||||
L'#', Tile::cobblestone,
|
||||
L'S');
|
||||
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::stoneSlabHalf, 6, StoneSlabTile::BRICK_SLAB), //
|
||||
L"sctg",
|
||||
L"###", //
|
||||
@@ -580,7 +580,7 @@ Recipes::Recipes()
|
||||
L"# X", //
|
||||
L" #X", //
|
||||
|
||||
L'X', Item::string,//
|
||||
L'X', Item::string,//
|
||||
L'#', Item::stick,
|
||||
L'T');
|
||||
|
||||
@@ -590,8 +590,8 @@ Recipes::Recipes()
|
||||
L"#", //
|
||||
L"Y", //
|
||||
|
||||
L'Y', Item::feather,//
|
||||
L'X', Item::flint,//
|
||||
L'Y', Item::feather,//
|
||||
L'X', Item::flint,//
|
||||
L'#', Item::stick,
|
||||
L'T');
|
||||
|
||||
@@ -751,7 +751,7 @@ Recipes::Recipes()
|
||||
L"~~ ", //
|
||||
L"~O ", //
|
||||
L" ~", //
|
||||
|
||||
|
||||
L'~', Item::string, L'O', Item::slimeBall,
|
||||
L'T');
|
||||
|
||||
@@ -773,7 +773,7 @@ Recipes::Recipes()
|
||||
|
||||
L'#', Item::paper, L'X', Item::compass,
|
||||
L'T');
|
||||
|
||||
|
||||
addShapedRecipy(new ItemInstance(Tile::button, 1), //
|
||||
L"sctg",
|
||||
L"#", //
|
||||
@@ -922,7 +922,7 @@ Recipes::Recipes()
|
||||
L'#', Item::stick, L'X', Item::leather,
|
||||
L'D');
|
||||
|
||||
pOreRecipies->addRecipes(this);
|
||||
pOreRecipies->addRecipes(this);
|
||||
|
||||
addShapedRecipy(new ItemInstance(Item::goldIngot), //
|
||||
L"ssscig",
|
||||
@@ -996,17 +996,17 @@ Recipes::Recipes()
|
||||
|
||||
// Sort so the largest recipes get checked first!
|
||||
/* 4J-PB - TODO
|
||||
Collections.sort(recipies, new Comparator<Recipy>()
|
||||
Collections.sort(recipies, new Comparator<Recipy>()
|
||||
{
|
||||
public: int compare(Recipy r0, Recipy r1)
|
||||
public: int compare(Recipy r0, Recipy r1)
|
||||
{
|
||||
|
||||
// shapeless recipes are put in the back of the list
|
||||
if (r0 instanceof ShapelessRecipy && r1 instanceof ShapedRecipy)
|
||||
if (r0 instanceof ShapelessRecipy && r1 instanceof ShapedRecipy)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (r1 instanceof ShapelessRecipy && r0 instanceof ShapedRecipy)
|
||||
if (r1 instanceof ShapelessRecipy && r0 instanceof ShapedRecipy)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -1059,7 +1059,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...)
|
||||
|
||||
wchTypes = va_arg(vl,wchar_t *);
|
||||
|
||||
for(int i = 0; wchTypes[i] != L'\0'; ++i )
|
||||
for(int i = 0; wchTypes[i] != L'\0'; ++i )
|
||||
{
|
||||
if(wchTypes[i+1]==L'\0' && wchTypes[i]!=L'g')
|
||||
{
|
||||
@@ -1153,15 +1153,15 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...)
|
||||
|
||||
ids = new ItemInstance *[width * height];
|
||||
|
||||
for (int j = 0; j < width * height; j++)
|
||||
for (int j = 0; j < width * height; j++)
|
||||
{
|
||||
wchar_t ch = map[j];
|
||||
myMap::iterator it=mappings->find(ch);
|
||||
if (it != mappings->end())
|
||||
if (it != mappings->end())
|
||||
{
|
||||
ids[j] =it->second;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
ids[j] = NULL;
|
||||
}
|
||||
@@ -1175,7 +1175,7 @@ ShapedRecipy *Recipes::addShapedRecipy(ItemInstance *result, ...)
|
||||
return recipe;
|
||||
}
|
||||
|
||||
void Recipes::addShapelessRecipy(ItemInstance *result,... )
|
||||
void Recipes::addShapelessRecipy(ItemInstance *result,... )
|
||||
{
|
||||
va_list vl;
|
||||
wchar_t *szTypes;
|
||||
@@ -1194,7 +1194,7 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... )
|
||||
// t - Tile *
|
||||
szTypes = va_arg(vl,wchar_t *);
|
||||
|
||||
for(int i = 0; szTypes[i] != L'\0'; ++i )
|
||||
for(int i = 0; szTypes[i] != L'\0'; ++i )
|
||||
{
|
||||
switch(szTypes[i])
|
||||
{
|
||||
@@ -1245,10 +1245,10 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... )
|
||||
break; }
|
||||
}
|
||||
|
||||
recipies->push_back(new ShapelessRecipy(result, ingredients, group));
|
||||
recipies->push_back(new ShapelessRecipy(result, ingredients, group));
|
||||
}
|
||||
|
||||
shared_ptr<ItemInstance> Recipes::getItemFor(shared_ptr<CraftingContainer> craftSlots, Level *level, Recipy *recipesClass /*= NULL*/)
|
||||
shared_ptr<ItemInstance> Recipes::getItemFor(shared_ptr<CraftingContainer> craftSlots, Level *level, Recipy *recipesClass /*= NULL*/)
|
||||
{
|
||||
int count = 0;
|
||||
shared_ptr<ItemInstance> first = nullptr;
|
||||
@@ -1281,23 +1281,21 @@ shared_ptr<ItemInstance> Recipes::getItemFor(shared_ptr<CraftingContainer> craft
|
||||
}
|
||||
else
|
||||
{
|
||||
AUTO_VAR(itEnd, recipies->end());
|
||||
for (AUTO_VAR(it, recipies->begin()); it != itEnd; it++)
|
||||
for (auto& r : *recipies)
|
||||
{
|
||||
Recipy *r = *it; //recipies->at(i);
|
||||
if (r->matches(craftSlots, level)) return r->assemble(craftSlots);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
vector <Recipy *> *Recipes::getRecipies()
|
||||
vector <Recipy *> *Recipes::getRecipies()
|
||||
{
|
||||
return recipies;
|
||||
}
|
||||
|
||||
// 4J-PB - added to deal with Xb0x 'crafting'
|
||||
shared_ptr<ItemInstance> Recipes::getItemForRecipe(Recipy *r)
|
||||
shared_ptr<ItemInstance> Recipes::getItemForRecipe(Recipy *r)
|
||||
{
|
||||
return r->assemble(nullptr);
|
||||
}
|
||||
@@ -1312,11 +1310,8 @@ void Recipes::buildRecipeIngredientsArray(void)
|
||||
m_pRecipeIngredientsRequired= new Recipy::INGREDIENTS_REQUIRED [iRecipeC];
|
||||
|
||||
int iCount=0;
|
||||
AUTO_VAR(itEndRec, recipies->end());
|
||||
for (AUTO_VAR(it, recipies->begin()); it != itEndRec; it++)
|
||||
for (auto& recipe : *recipies)
|
||||
{
|
||||
Recipy *recipe = *it;
|
||||
//wprintf(L"RECIPE - [%d] is %w\n",iCount,recipe->getResultItem()->getItem()->getName());
|
||||
recipe->requires(&m_pRecipeIngredientsRequired[iCount++]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user