Luanti 5.10.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)
 
Inventoryoperator= (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)
 
InventoryListaddList (const std::string &name, u32 size)
 
InventoryListgetList (const std::string &name)
 
const InventoryListgetList (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
 
IItemDefManagerm_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().

+ Here is the call graph for this function:

◆ Inventory() [2/2]

Inventory::Inventory ( const Inventory & other)

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()

InventoryList * Inventory::addList ( const std::string & name,
u32 size )

◆ 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::deSerialize(), errorstream, getList(), m_itemdef, m_lists, setModified(), and InventoryList::setSize().

Referenced by content_nodemeta_deserialize_legacy_body(), NodeMetadata::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)

◆ 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

◆ operator=()

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

References clear(), m_itemdef, m_lists, and setModified().

+ Here is the call graph for this function:

◆ operator==()

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

References m_lists.

◆ serialize()

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

References m_lists.

Referenced by PlayerDatabaseLevelDB::savePlayer(), Server::sendDetachedInventory(), Server::SendInventory(), NodeMetadata::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: