summaryrefslogtreecommitdiffstats
path: root/src/ItemGrid.cpp
diff options
context:
space:
mode:
authorTobias Wilken <TooAngel@TooAngel.de>2020-07-14 18:56:42 +0200
committerGitHub <noreply@github.com>2020-07-14 18:56:42 +0200
commit36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9 (patch)
tree04c224231a800002692a296131af4988dd465845 /src/ItemGrid.cpp
parentCustom command depend is automatic (diff)
downloadcuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.gz
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.bz2
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.lz
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.xz
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.tar.zst
cuberite-36eab1b3237dbeeaaf5b48808bf0d47eb4bd32e9.zip
Diffstat (limited to '')
-rw-r--r--src/ItemGrid.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/ItemGrid.cpp b/src/ItemGrid.cpp
index 045f083c8..790f078fc 100644
--- a/src/ItemGrid.cpp
+++ b/src/ItemGrid.cpp
@@ -440,6 +440,31 @@ int cItemGrid::RemoveItem(const cItem & a_ItemStack)
+cItem * cItemGrid::FindItem(const cItem & a_RecipeItem)
+{
+ if (!m_Slots.IsStorageAllocated())
+ {
+ return nullptr;
+ }
+
+ for (int i = 0; i < m_Slots.size(); i++)
+ {
+ // Items are equal if none is greater the other
+ auto compare = cItem::sItemCompare{};
+ if (!compare(a_RecipeItem, m_Slots[i]) &&
+ !compare(m_Slots[i], a_RecipeItem))
+ {
+ return &m_Slots[i];
+ }
+ }
+
+ return nullptr;
+}
+
+
+
+
+
int cItemGrid::ChangeSlotCount(int a_SlotNum, int a_AddToCount)
{
if (!IsValidSlotNum(a_SlotNum))
@@ -825,7 +850,3 @@ void cItemGrid::TriggerListeners(int a_SlotNum)
} // for itr - m_Listeners[]
m_IsInTriggerListeners = false;
}
-
-
-
-