From 221cc4ec5cb6301743e947eaabed3fecedba796f Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 16 Oct 2019 10:06:34 +0200 Subject: Refactored block-to-pickup conversion. (#4417) --- src/Item.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Item.cpp') diff --git a/src/Item.cpp b/src/Item.cpp index 5d486fdab..16aa22b50 100644 --- a/src/Item.cpp +++ b/src/Item.cpp @@ -2,6 +2,7 @@ #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Item.h" +#include "ItemGrid.h" #include "json/json.h" #include "Items/ItemHandler.h" @@ -626,6 +627,15 @@ int cItem::AddEnchantmentsFromItem(const cItem & a_Other) //////////////////////////////////////////////////////////////////////////////// // cItems: +cItems::cItems(cItem && a_InitialItem) +{ + push_back(std::move(a_InitialItem)); +} + + + + + cItem * cItems::Get(int a_Idx) { if ((a_Idx < 0) || (a_Idx >= static_cast(size()))) @@ -711,3 +721,14 @@ bool cItems::ContainsType(const cItem & a_Item) } + + + +void cItems::AddItemGrid(const cItemGrid & a_ItemGrid) +{ + auto numSlots = a_ItemGrid.GetNumSlots(); + for (int i = 0; i < numSlots; ++i) + { + Add(a_ItemGrid.GetSlot(i)); + } +} -- cgit v1.2.3