Minetest  5.4.0
ServerInventoryManager Class Reference

#include <serverinventorymgr.h>

+ Inheritance diagram for ServerInventoryManager:
+ Collaboration diagram for ServerInventoryManager:

Classes

struct  DetachedInventory
 

Public Member Functions

 ServerInventoryManager ()
 
virtual ~ServerInventoryManager ()
 
void setEnv (ServerEnvironment *env)
 
InventorygetInventory (const InventoryLocation &loc)
 
void setInventoryModified (const InventoryLocation &loc)
 
InventorycreateDetachedInventory (const std::string &name, IItemDefManager *idef, const std::string &player="")
 
bool removeDetachedInventory (const std::string &name)
 
void sendDetachedInventories (const std::string &peer_name, bool incremental, std::function< void(const std::string &, Inventory *)> apply_cb)
 
- Public Member Functions inherited from InventoryManager
 InventoryManager ()=default
 
virtual ~InventoryManager ()=default
 
virtual void inventoryAction (InventoryAction *a)
 

Private Attributes

ServerEnvironmentm_env = nullptr
 
std::unordered_map< std::string, DetachedInventorym_detached_inventories
 

Constructor & Destructor Documentation

◆ ServerInventoryManager()

ServerInventoryManager::ServerInventoryManager ( )

◆ ~ServerInventoryManager()

ServerInventoryManager::~ServerInventoryManager ( )
virtual

Member Function Documentation

◆ createDetachedInventory()

Inventory * ServerInventoryManager::createDetachedInventory ( const std::string &  name,
IItemDefManager idef,
const std::string &  player = "" 
)

References ServerEnvironment::getGameDef(), ServerEnvironment::getPlayer(), infostream, m_detached_inventories, m_env, p(), PEER_ID_INEXISTENT, sanity_check, and Server::sendDetachedInventory().

+ Here is the call graph for this function:

◆ getInventory()

Inventory * ServerInventoryManager::getInventory ( const InventoryLocation loc)
virtual

Reimplemented from InventoryManager.

References InventoryLocation::CURRENT_PLAYER, InventoryLocation::DETACHED, NodeMetadata::getInventory(), PlayerSAO::getInventory(), ServerEnvironment::getMap(), Map::getNodeMetadata(), ServerEnvironment::getPlayer(), RemotePlayer::getPlayerSAO(), m_detached_inventories, m_env, InventoryLocation::name, InventoryLocation::NODEMETA, InventoryLocation::p, InventoryLocation::PLAYER, sanity_check, InventoryLocation::type, and InventoryLocation::UNDEFINED.

Referenced by InvRef::getinv().

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

◆ removeDetachedInventory()

bool ServerInventoryManager::removeDetachedInventory ( const std::string &  name)

References ServerEnvironment::getGameDef(), RemotePlayer::getPeerId(), ServerEnvironment::getPlayer(), m_detached_inventories, m_env, PEER_ID_INEXISTENT, and Server::sendDetachedInventory().

+ Here is the call graph for this function:

◆ sendDetachedInventories()

void ServerInventoryManager::sendDetachedInventories ( const std::string &  peer_name,
bool  incremental,
std::function< void(const std::string &, Inventory *)>  apply_cb 
)

References Inventory::checkModified(), ServerInventoryManager::DetachedInventory::inventory, m_detached_inventories, and ServerInventoryManager::DetachedInventory::owner.

+ Here is the call graph for this function:

◆ setEnv()

void ServerInventoryManager::setEnv ( ServerEnvironment env)
inline

References m_env.

◆ setInventoryModified()

void ServerInventoryManager::setInventoryModified ( const InventoryLocation loc)
virtual

Reimplemented from InventoryManager.

References InventoryLocation::DETACHED, Map::dispatchEvent(), ServerEnvironment::getMap(), ServerEnvironment::getPlayer(), Player::inventory, m_env, MEET_BLOCK_NODE_METADATA_CHANGED, InventoryLocation::name, InventoryLocation::NODEMETA, InventoryLocation::p, InventoryLocation::PLAYER, sanity_check, Inventory::setModified(), RemotePlayer::setModified(), InventoryLocation::type, MapEditEvent::type, and InventoryLocation::UNDEFINED.

Referenced by InvRef::reportInventoryChange().

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

Member Data Documentation

◆ m_detached_inventories

std::unordered_map<std::string, DetachedInventory> ServerInventoryManager::m_detached_inventories
private

◆ m_env

ServerEnvironment* ServerInventoryManager::m_env = nullptr
private

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