1
0

Refactored block-to-pickup conversion. (#4417)

This commit is contained in:
Mattes D
2019-10-16 10:06:34 +02:00
committed by GitHub
parent 241d97bbf9
commit 221cc4ec5c
121 changed files with 2496 additions and 1744 deletions

View File

@@ -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<int>(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));
}
}