Fixed a bug in crafting recipes - would consume multiple items of asterisked ingredients (FS #205)
git-svn-id: http://mc-server.googlecode.com/svn/trunk@593 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
6bf5fa0d88
commit
429ccb59b5
@ -457,30 +457,37 @@ cCraftingRecipes::cRecipe * cCraftingRecipes::MatchRecipe(const cItem * a_Crafti
|
|||||||
EndY = itrS->y;
|
EndY = itrS->y;
|
||||||
}
|
}
|
||||||
bool Found = false;
|
bool Found = false;
|
||||||
for (int x = StartX; x <= EndX; x++) for (int y = StartY; y <= EndY; y++)
|
for (int x = StartX; x <= EndX; x++)
|
||||||
{
|
{
|
||||||
if (HasMatched[x][y])
|
for (int y = StartY; y <= EndY; y++)
|
||||||
{
|
{
|
||||||
// Already matched some other item
|
if (HasMatched[x][y])
|
||||||
continue;
|
{
|
||||||
}
|
// Already matched some other item
|
||||||
int GridIdx = x + a_GridStride * y;
|
continue;
|
||||||
if (
|
}
|
||||||
(a_CraftingGrid[GridIdx].m_ItemID == itrS->m_Item.m_ItemID) &&
|
int GridIdx = x + a_GridStride * y;
|
||||||
(
|
if (
|
||||||
(itrS->m_Item.m_ItemHealth < 0) || // doesn't want damage comparison
|
(a_CraftingGrid[GridIdx].m_ItemID == itrS->m_Item.m_ItemID) &&
|
||||||
(itrS->m_Item.m_ItemHealth == a_CraftingGrid[GridIdx].m_ItemHealth) // the damage matches
|
(
|
||||||
|
(itrS->m_Item.m_ItemHealth < 0) || // doesn't want damage comparison
|
||||||
|
(itrS->m_Item.m_ItemHealth == a_CraftingGrid[GridIdx].m_ItemHealth) // the damage matches
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
{
|
||||||
|
HasMatched[x][y] = true;
|
||||||
|
Found = true;
|
||||||
|
MatchedSlots.push_back(*itrS);
|
||||||
|
MatchedSlots.back().x = x;
|
||||||
|
MatchedSlots.back().y = y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} // for y
|
||||||
|
if (Found)
|
||||||
{
|
{
|
||||||
HasMatched[x][y] = true;
|
|
||||||
Found = true;
|
|
||||||
MatchedSlots.push_back(*itrS);
|
|
||||||
MatchedSlots.back().x = x;
|
|
||||||
MatchedSlots.back().y = y;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // for y, for x - "anywhere"
|
} // for x
|
||||||
if (!Found)
|
if (!Found)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user