throw SerializationError(ss.str());
}
-InventoryList::InventoryList(const InventoryList &other)
-{
- *this = other;
-}
-
InventoryList & InventoryList::operator = (const InventoryList &other)
{
m_items = other.m_items;
return true;
}
-const std::string &InventoryList::getName() const
-{
- return m_name;
-}
-
-u32 InventoryList::getSize() const
-{
- return m_items.size();
-}
-
-u32 InventoryList::getWidth() const
-{
- return m_width;
-}
-
u32 InventoryList::getUsedSlots() const
{
u32 num = 0;
return num;
}
-u32 InventoryList::getFreeSlots() const
-{
- return getSize() - getUsedSlots();
-}
-
-const ItemStack& InventoryList::getItem(u32 i) const
-{
- assert(i < m_size); // Pre-condition
- return m_items[i];
-}
-
-ItemStack& InventoryList::getItem(u32 i)
-{
- assert(i < m_size); // Pre-condition
- return m_items[i];
-}
-
ItemStack InventoryList::changeItem(u32 i, const ItemStack &newitem)
{
if(i >= m_items.size())
return m_lists[i];
}
-std::vector<const InventoryList*> Inventory::getLists()
-{
- std::vector<const InventoryList*> lists;
- lists.reserve(m_lists.size());
- for (auto list : m_lists) {
- lists.push_back(list);
- }
- return lists;
-}
-
bool Inventory::deleteList(const std::string &name)
{
s32 i = getListIndex(name);
return m_lists[i];
}
-const s32 Inventory::getListIndex(const std::string &name) const
+s32 Inventory::getListIndex(const std::string &name) const
{
for(u32 i=0; i<m_lists.size(); i++)
{