aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/ShapelessRecipy.cpp
diff options
context:
space:
mode:
authorvoid_17 <61356189+void2012@users.noreply.github.com>2026-03-06 02:11:18 +0700
committerGitHub <noreply@github.com>2026-03-06 02:11:18 +0700
commit55231bb8d3e1a4e2752ac3d444c4287eb0ca4e8b (patch)
tree953c537a5c66e328e9f4ab29626cf738112d53c0 /Minecraft.World/ShapelessRecipy.cpp
parent7d6658fe5b3095f35093701b5ab669ffc291e875 (diff)
Remove AUTO_VAR macro and _toString function (#592)
Diffstat (limited to 'Minecraft.World/ShapelessRecipy.cpp')
-rw-r--r--Minecraft.World/ShapelessRecipy.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/Minecraft.World/ShapelessRecipy.cpp b/Minecraft.World/ShapelessRecipy.cpp
index 67ed0381..44bf6a54 100644
--- a/Minecraft.World/ShapelessRecipy.cpp
+++ b/Minecraft.World/ShapelessRecipy.cpp
@@ -39,18 +39,17 @@ bool ShapelessRecipy::matches(shared_ptr<CraftingContainer> craftSlots, Level *l
{
shared_ptr<ItemInstance> item = craftSlots->getItem(x, y);
- if (item != NULL)
+ if (item)
{
bool found = false;
- AUTO_VAR(citEnd, ingredients->end());
- for (AUTO_VAR(cit, ingredients->begin()); cit != citEnd; ++cit)
+ auto citEnd = ingredients->end();
+ for ( ItemInstance *ingredient : *ingredients )
{
- ItemInstance *ingredient = *cit;
if (item->id == ingredient->id && (ingredient->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == ingredient->getAuxValue()))
{
found = true;
- AUTO_VAR( it, find(tempList.begin(), tempList.end(), ingredient ) );
+ auto it = find(tempList.begin(), tempList.end(), ingredient);
if(it != tempList.end() ) tempList.erase(it);
break;
}
@@ -86,9 +85,8 @@ bool ShapelessRecipy::requires(int iRecipe)
//printf("ShapelessRecipy %d\n",iRecipe);
- AUTO_VAR(citEnd, ingredients->end());
int iCount=0;
- for (vector<ItemInstance *>::iterator ingredient = ingredients->begin(); ingredient != citEnd; ingredient++)
+ for ( auto ingredient = ingredients->begin(); ingredient != ingredients->end(); ingredient++)
{
//printf("\tIngredient %d is %d\n",iCount++,(*ingredient)->id);
//if (item->id == (*ingredient)->id && ((*ingredient)->getAuxValue() == Recipes::ANY_AUX_VALUE || item->getAuxValue() == (*ingredient)->getAuxValue()))
@@ -119,15 +117,11 @@ void ShapelessRecipy::requires(INGREDIENTS_REQUIRED *pIngReq)
memset(TempIngReq.iIngAuxValA,Recipes::ANY_AUX_VALUE,sizeof(int)*9);
ZeroMemory(TempIngReq.uiGridA,sizeof(unsigned int)*9);
- AUTO_VAR(citEnd, ingredients->end());
-
- for (vector<ItemInstance *>::const_iterator ingredient = ingredients->begin(); ingredient != citEnd; ingredient++)
+ for ( ItemInstance *expected : *ingredients )
{
- ItemInstance *expected = *ingredient;
-
- if (expected!=NULL)
+ if ( expected )
{
- int iAuxVal = (*ingredient)->getAuxValue();
+ int iAuxVal = expected->getAuxValue();
TempIngReq.uiGridA[iCount++]=expected->id | iAuxVal<<24;
// 4J-PB - put the ingredients in boxes 1,2,4,5 so we can see them in a 2x2 crafting screen
if(iCount==2) iCount=3;