aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp
diff options
context:
space:
mode:
authorqwasdrizzel <145519042+qwasdrizzel@users.noreply.github.com>2026-03-16 21:44:26 -0500
committerGitHub <noreply@github.com>2026-03-16 21:44:26 -0500
commitce739f6045ec72127491286ea3f3f21e537c1b55 (patch)
treef33bd42a47c1b4a7b2153a7fb77127ee3b407db9 /Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp
parent255a18fe8e9b57377975f82e2b227afe2a12eda0 (diff)
parent5a59f5d146b43811dde6a5a0245ee9875d7b5cd1 (diff)
Merge branch 'smartcmd:main' into main
Diffstat (limited to 'Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp')
-rw-r--r--Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp
index fc012be3..6fddece9 100644
--- a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp
+++ b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp
@@ -6,6 +6,8 @@
#include "..\..\LocalPlayer.h"
#include "IUIScene_CraftingMenu.h"
+#include "UI.h"
+
Recipy::_eGroupType IUIScene_CraftingMenu::m_GroupTypeMapping4GridA[IUIScene_CraftingMenu::m_iMaxGroup2x2]=
{
Recipy::eGroupType_Structure,
@@ -154,10 +156,10 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
Minecraft *pMinecraft = Minecraft::GetInstance();
- if( pMinecraft->localgameModes[getPad()] != NULL )
+ if( pMinecraft->localgameModes[getPad()] != nullptr )
{
Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial();
- if(tutorial != NULL)
+ if(tutorial != nullptr)
{
tutorial->handleUIInput(iAction);
if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction))
@@ -211,10 +213,10 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
- if( pMinecraft->localgameModes[iPad] != NULL)
+ if( pMinecraft->localgameModes[iPad] != nullptr)
{
Tutorial *tutorial = pMinecraft->localgameModes[iPad]->getTutorial();
- if(tutorial != NULL)
+ if(tutorial != nullptr)
{
tutorial->onCrafted(pTempItemInst);
}
@@ -247,10 +249,10 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
- if( pMinecraft->localgameModes[iPad] != NULL )
+ if( pMinecraft->localgameModes[iPad] != nullptr )
{
Tutorial *tutorial = pMinecraft->localgameModes[iPad]->getTutorial();
- if(tutorial != NULL)
+ if(tutorial != nullptr)
{
tutorial->createItemSelected(pTempItemInst, pRecipeIngredientsRequired[iRecipe].bCanMake[iPad]);
}
@@ -288,12 +290,12 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
}
// 4J Stu - Fix for #13097 - Bug: Milk Buckets are removed when crafting Cake
- if (ingItemInst != NULL)
+ if (ingItemInst != nullptr)
{
if (ingItemInst->getItem()->hasCraftingRemainingItem())
{
// replace item with remaining result
- m_pPlayer->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
+ m_pPlayer->inventory->add(std::make_shared<ItemInstance>(ingItemInst->getItem()->getCraftingRemainingItem()));
}
}
@@ -608,7 +610,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
// dump out the inventory
/* for (unsigned int k = 0; k < m_pPlayer->inventory->items.length; k++)
{
- if (m_pPlayer->inventory->items[k] != NULL)
+ if (m_pPlayer->inventory->items[k] != nullptr)
{
wstring itemstring=m_pPlayer->inventory->items[k]->toString();
@@ -620,15 +622,15 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
*/
RecipyList *recipes = ((Recipes *)Recipes::getInstance())->getRecipies();
Recipy::INGREDIENTS_REQUIRED *pRecipeIngredientsRequired=Recipes::getInstance()->getRecipeIngredientsArray();
- int iRecipeC=(int)recipes->size();
+ int iRecipeC=static_cast<int>(recipes->size());
auto itRecipe = recipes->begin();
// dump out the recipe products
// for (int i = 0; i < iRecipeC; i++)
// {
- // shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL);
- // if (pTempItemInst != NULL)
+ // shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr);
+ // if (pTempItemInst != nullptr)
// {
// wstring itemstring=pTempItemInst->toString();
//
@@ -683,7 +685,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
// Does the player have this ingredient?
for (unsigned int k = 0; k < m_pPlayer->inventory->items.length; k++)
{
- if (m_pPlayer->inventory->items[k] != NULL)
+ if (m_pPlayer->inventory->items[k] != nullptr)
{
// do they have the ingredient, and the aux value matches, and enough off it?
if((m_pPlayer->inventory->items[k]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) &&
@@ -703,7 +705,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
for(unsigned int l=0;l<m_pPlayer->inventory->items.length;l++)
{
- if (m_pPlayer->inventory->items[l] != NULL)
+ if (m_pPlayer->inventory->items[l] != nullptr)
{
if(
(m_pPlayer->inventory->items[l]->id == pRecipeIngredientsRequired[i].iIngIDA[j]) &&
@@ -1071,7 +1073,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
int iAuxVal=pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i];
Item *item = Item::items[id];
- shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal));
+ shared_ptr<ItemInstance> itemInst= std::make_shared<ItemInstance>(item, pRecipeIngredientsRequired[iRecipe].iIngValA[i], iAuxVal);
// 4J-PB - a very special case - the bed can use any kind of wool, so we can't use the item description
// and the same goes for the painting
@@ -1156,7 +1158,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
{
iAuxVal = 1;
}
- shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
+ shared_ptr<ItemInstance> itemInst= std::make_shared<ItemInstance>(id, 1, iAuxVal);
setIngredientSlotItem(getPad(),index,itemInst);
// show the ingredients we don't have if we can't make the recipe
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))