Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
ServerInventoryManager Class Reference

#include <serverinventorymgr.h>

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

Classes

struct  DetachedInventory
 

Public Member Functions

 ServerInventoryManager ()
 
virtual ~ServerInventoryManager ()=default
 
void setEnv (ServerEnvironment *env)
 
virtual InventorygetInventory (const InventoryLocation &loc)
 
virtual void setInventoryModified (const InventoryLocation &loc)
 
InventorycreateDetachedInventory (const std::string &name, IItemDefManager *idef, const std::string &player="")
 
bool removeDetachedInventory (const std::string &name)
 
bool checkDetachedInventoryAccess (const InventoryLocation &loc, const std::string &player) const
 
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)
 

Protected Attributes

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

Constructor & Destructor Documentation

◆ ServerInventoryManager()

ServerInventoryManager::ServerInventoryManager ( )

◆ ~ServerInventoryManager()

virtual ServerInventoryManager::~ServerInventoryManager ( )
virtualdefault

Member Function Documentation

◆ checkDetachedInventoryAccess()

bool ServerInventoryManager::checkDetachedInventoryAccess ( const InventoryLocation & loc,
const std::string & player ) const

References InventoryLocation::DETACHED, m_detached_inventories, InventoryLocation::name, SANITY_CHECK, and InventoryLocation::type.

Referenced by Server::handleCommand_InventoryAction().

+ Here is the caller graph for this function:

◆ 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.

Reimplemented in MockInventoryManager.

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.

Referenced by Server::sendDetachedInventories().

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

◆ setEnv()

void ServerInventoryManager::setEnv ( ServerEnvironment * env)
inline

References m_env.

Referenced by Server::init().

+ Here is the caller graph for this function:

◆ setInventoryModified()

void ServerInventoryManager::setInventoryModified ( const InventoryLocation & loc)
virtual

Reimplemented from InventoryManager.

Reimplemented in MockInventoryManager.

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 Server::handleCommand_InventoryAction(), and 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
protected

◆ m_env

ServerEnvironment* ServerInventoryManager::m_env = nullptr
protected

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