summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-09 20:52:30 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-09 20:52:30 +0200
commit429ccb59b580c8925563d116ed132b55b6a58a80 (patch)
tree3d7570ddbdcfbcb5c3868bc5e702c9df70cd9eda
parentDisallowed placing cacti in water (diff)
downloadcuberite-429ccb59b580c8925563d116ed132b55b6a58a80.tar
cuberite-429ccb59b580c8925563d116ed132b55b6a58a80.tar.gz
cuberite-429ccb59b580c8925563d116ed132b55b6a58a80.tar.bz2
cuberite-429ccb59b580c8925563d116ed132b55b6a58a80.tar.lz
cuberite-429ccb59b580c8925563d116ed132b55b6a58a80.tar.xz
cuberite-429ccb59b580c8925563d116ed132b55b6a58a80.tar.zst
cuberite-429ccb59b580c8925563d116ed132b55b6a58a80.zip
-rw-r--r--source/CraftingRecipes.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/source/CraftingRecipes.cpp b/source/CraftingRecipes.cpp
index 391de691b..37d82965e 100644
--- a/source/CraftingRecipes.cpp
+++ b/source/CraftingRecipes.cpp
@@ -457,30 +457,37 @@ cCraftingRecipes::cRecipe * cCraftingRecipes::MatchRecipe(const cItem * a_Crafti
EndY = itrS->y;
}
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
- continue;
- }
- int GridIdx = x + a_GridStride * y;
- if (
- (a_CraftingGrid[GridIdx].m_ItemID == itrS->m_Item.m_ItemID) &&
- (
- (itrS->m_Item.m_ItemHealth < 0) || // doesn't want damage comparison
- (itrS->m_Item.m_ItemHealth == a_CraftingGrid[GridIdx].m_ItemHealth) // the damage matches
+ if (HasMatched[x][y])
+ {
+ // Already matched some other item
+ continue;
+ }
+ int GridIdx = x + a_GridStride * y;
+ if (
+ (a_CraftingGrid[GridIdx].m_ItemID == itrS->m_Item.m_ItemID) &&
+ (
+ (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;
}
- } // for y, for x - "anywhere"
+ } // for x
if (!Found)
{
return NULL;