Luanti 5.19.0-dev
Loading...
Searching...
No Matches
Inventory Class Reference

#include <inventory.h>

Collaboration diagram for Inventory:

Public Member Functions

 ~Inventory ()
void clear ()
 Inventory (IItemDefManager *itemdef)
 Inventory (const Inventory &other)
Inventory & operator= (const Inventory &other)
bool operator== (const Inventory &other) const
bool operator!= (const Inventory &other) const
void serialize (std::ostream &os, bool incremental=false) const
void deSerialize (std::istream &is)
InventoryList * addList (const std::string &name, u32 size)
InventoryList * getList (const std::string &name)
const InventoryList * getList (const std::string &name) const
const std::vector< InventoryList * > & getLists () const
bool deleteList (const std::string &name)
ItemStack addItem (const std::string &listname, const ItemStack &newitem)
bool checkModified () const
void setModified (bool dirty=true)

Private Member Functions

s32 getListIndex (const std::string &name) const

Private Attributes

std::vector< InventoryList * > m_lists
IItemDefManager * m_itemdef
bool m_dirty = true

Constructor & Destructor Documentation

◆ ~Inventory()

Inventory::~Inventory ( )

References clear().

Here is the call graph for this function:

◆ Inventory() [1/2]

Inventory::Inventory ( IItemDefManager * itemdef)

References m_itemdef, and setModified().

Referenced by Inventory(), Client::handleCommand_DetachedInventory(), operator!=(), operator=(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Inventory() [2/2]

Inventory::Inventory ( const Inventory & other)

References Inventory().

Here is the call graph for this function:

Member Function Documentation

◆ addItem()

ItemStack Inventory::addItem ( const std::string & listname,
const ItemStack & newitem )
inline

References InventoryList::addItem(), and getList().

Here is the call graph for this function:

◆ addList()

◆ checkModified()

bool Inventory::checkModified ( ) const
inline

References m_dirty, and m_lists.

Referenced by RemotePlayer::checkModified(), and ServerInventoryManager::sendDetachedInventories().

Here is the caller graph for this function:

◆ clear()

void Inventory::clear ( )

References m_lists, and setModified().

Referenced by Player::Player(), ~Inventory(), NodeMetadata::clear(), InvRef::l_set_lists(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteList()

bool Inventory::deleteList ( const std::string & name)

References getListIndex(), m_lists, and setModified().

Referenced by InvRef::l_set_size(), and read_inventory_list().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ deSerialize()

void Inventory::deSerialize ( std::istream & is)

References InventoryList::InventoryList(), SerializationError::SerializationError(), InventoryList::deSerialize(), errorstream, getList(), m_itemdef, m_lists, setModified(), and InventoryList::setSize().

Referenced by content_nodemeta_deserialize_legacy_body(), NodeMetadata::deSerialize(), PlayerDatabaseFiles::deSerialize(), Client::handleCommand_DetachedInventory(), Client::handleCommand_Inventory(), PlayerDatabaseLevelDB::loadPlayer(), and TestInventory::testSerializeDeserialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getList() [1/2]

InventoryList * Inventory::getList ( const std::string & name)

References getListIndex(), and m_lists.

Referenced by addItem(), ICraftAction::apply(), IDropAction::apply(), IMoveAction::apply(), RollbackAction::applyRevert(), IDropAction::clientApply(), IMoveAction::clientApply(), content_nodemeta_deserialize_legacy_body(), deSerialize(), PlayerDatabaseFiles::deSerialize(), GUIInventoryList::draw(), Hud::drawHotbar(), Hud::drawLuaElements(), GUIFormSpecMenu::drawSelectedItem(), getCraftingResult(), GUIInventoryList::getItemIndexAtPos(), InvRef::getlist(), Player::getMaxHotbarItemcount(), Player::getWieldedItem(), Server::handleCommand_InventoryAction(), InvRef::l_get_list(), InvRef::l_set_list(), InvRef::l_set_size(), InvRef::l_set_width(), GUIFormSpecMenu::OnEvent(), PlayerSAO::setWieldedItem(), Player::setWieldIndex(), TestMoveAction::testMove(), TestMoveAction::testMovePartial(), TestMoveAction::testMoveSomewhere(), TestMoveAction::testMoveSomewherePartial(), TestMoveAction::testMoveUnallowed(), TestInventory::testSerializeDeserialize(), TestMoveAction::testSwap(), TestMoveAction::testSwapFromUnallowed(), TestMoveAction::testSwapToUnallowed(), Server::UpdateCrafting(), GUIFormSpecMenu::updateSelectedItem(), Client::updateWieldedItem(), and GUIFormSpecMenu::verifySelectedItem().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getList() [2/2]

const InventoryList * Inventory::getList ( const std::string & name) const

References getListIndex(), and m_lists.

Here is the call graph for this function:

◆ getListIndex()

s32 Inventory::getListIndex ( const std::string & name) const
private

References m_lists.

Referenced by addList(), deleteList(), getList(), and getList().

Here is the caller graph for this function:

◆ getLists()

const std::vector< InventoryList * > & Inventory::getLists ( ) const
inline

References m_lists.

Referenced by NodeMetadata::empty(), push_inventory_lists(), and PlayerDatabaseSQLite3::savePlayer().

Here is the caller graph for this function:

◆ operator!=()

bool Inventory::operator!= ( const Inventory & other) const
inline

References Inventory().

Here is the call graph for this function:

◆ operator=()

Inventory & Inventory::operator= ( const Inventory & other)

References Inventory(), InventoryList::InventoryList(), clear(), m_itemdef, m_lists, and setModified().

Here is the call graph for this function:

◆ operator==()

bool Inventory::operator== ( const Inventory & other) const

References Inventory(), and m_lists.

Here is the call graph for this function:

◆ serialize()

void Inventory::serialize ( std::ostream & os,
bool incremental = false ) const

References m_lists.

Referenced by PlayerDatabaseLevelDB::savePlayer(), Server::sendDetachedInventory(), Server::SendInventory(), NodeMetadata::serialize(), PlayerDatabaseFiles::serialize(), and TestInventory::testSerializeDeserialize().

Here is the caller graph for this function:

◆ setModified()

void Inventory::setModified ( bool dirty = true)
inline

References m_dirty, and m_lists.

Referenced by Inventory(), Player::Player(), addList(), clear(), deleteList(), deSerialize(), operator=(), Server::sendDetachedInventory(), Server::SendInventory(), ServerInventoryManager::setInventoryModified(), and TestInventory::testSerializeDeserialize().

Here is the caller graph for this function:

Member Data Documentation

◆ m_dirty

bool Inventory::m_dirty = true
private

Referenced by checkModified(), and setModified().

◆ m_itemdef

IItemDefManager* Inventory::m_itemdef
private

◆ m_lists


The documentation for this class was generated from the following files: