Luanti 5.18.0-dev
Loading...
Searching...
No Matches
ObjDefManager Class Reference

#include <objdef.h>

Inheritance diagram for ObjDefManager:
Collaboration diagram for ObjDefManager:

Public Member Functions

 ObjDefManager (IGameDef *gamedef, ObjDefType type)
virtual ~ObjDefManager ()
 DISABLE_CLASS_COPY (ObjDefManager)
virtual const char * getObjectTitle () const
virtual void clear ()
virtual ObjDef * getByName (const std::string &name) const
virtual ObjDefHandle add (ObjDef *obj)
virtual ObjDef * get (ObjDefHandle handle) const
virtual ObjDef * set (ObjDefHandle handle, ObjDef *obj)
virtual u32 addRaw (ObjDef *obj)
virtual ObjDef * getRaw (u32 index) const
virtual ObjDef * setRaw (u32 index, ObjDef *obj)
size_t getNumObjects () const
ObjDefType getType () const
const NodeDefManager * getNodeDef () const
u32 validateHandle (ObjDefHandle handle) const

Static Public Member Functions

static ObjDefHandle createHandle (u32 index, ObjDefType type, u32 uid)
static bool decodeHandle (ObjDefHandle handle, u32 *index, ObjDefType *type, u32 *uid)

Protected Member Functions

 ObjDefManager ()
void cloneTo (ObjDefManager *mgr) const

Protected Attributes

const NodeDefManager * m_ndef
std::vector< ObjDef * > m_objects
ObjDefType m_objtype

Constructor & Destructor Documentation

◆ ObjDefManager() [1/2]

ObjDefManager::ObjDefManager ( IGameDef * gamedef,
ObjDefType type )

References IGameDef::getNodeDefManager(), m_ndef, and m_objtype.

Referenced by BiomeManager::BiomeManager(), DecorationManager::DecorationManager(), MyObjDefManager::MyObjDefManager(), OreManager::OreManager(), SchematicManager::SchematicManager(), cloneTo(), and DISABLE_CLASS_COPY().

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

◆ ~ObjDefManager()

ObjDefManager::~ObjDefManager ( )
virtual

References m_objects.

◆ ObjDefManager() [2/2]

ObjDefManager::ObjDefManager ( )
inlineprotected

Member Function Documentation

◆ add()

ObjDefHandle ObjDefManager::add ( ObjDef * obj)
virtual

References addRaw(), createHandle(), getByName(), ObjDef::handle, m_objtype, ObjDef::name, OBJDEF_INVALID_HANDLE, OBJDEF_INVALID_INDEX, and ObjDef::uid.

Referenced by BiomeManager::BiomeManager(), get_or_load_biome(), get_or_load_schematic(), ModApiMapgen::l_register_biome(), ModApiMapgen::l_register_decoration(), ModApiMapgen::l_register_ore(), ModApiMapgen::l_register_schematic(), TestObjDef::testAddGetSetClear(), and TestObjDef::testClone().

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

◆ addRaw()

u32 ObjDefManager::addRaw ( ObjDef * obj)
virtual

References getObjectTitle(), ObjDef::index, infostream, m_objects, myrand(), ObjDef::name, OBJDEF_MAX_ITEMS, OBJDEF_UID_MASK, and ObjDef::uid.

Referenced by add().

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

◆ clear()

void ObjDefManager::clear ( )
virtual

Reimplemented in BiomeManager, OreManager, and SchematicManager.

References m_objects.

Referenced by SchematicManager::clear(), ModApiMapgen::l_clear_registered_decorations(), TestObjDef::testAddGetSetClear(), and TestObjDef::testClone().

Here is the caller graph for this function:

◆ cloneTo()

void ObjDefManager::cloneTo ( ObjDefManager * mgr) const
protected

References ObjDefManager(), m_ndef, m_objects, and m_objtype.

Referenced by BiomeManager::clone(), DecorationManager::clone(), MyObjDefManager::clone(), OreManager::clone(), and SchematicManager::clone().

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

◆ createHandle()

ObjDefHandle ObjDefManager::createHandle ( u32 index,
ObjDefType type,
u32 uid )
static

References calc_parity(), OBJDEF_HANDLE_SALT, and set_bits().

Referenced by add(), and TestObjDef::testHandles().

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

◆ decodeHandle()

bool ObjDefManager::decodeHandle ( ObjDefHandle handle,
u32 * index,
ObjDefType * type,
u32 * uid )
static

References calc_parity(), get_bits(), OBJDEF_HANDLE_SALT, and set_bits().

Referenced by TestObjDef::testHandles(), and validateHandle().

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

◆ DISABLE_CLASS_COPY()

ObjDefManager::DISABLE_CLASS_COPY ( ObjDefManager )

References ObjDefManager().

Here is the call graph for this function:

◆ get()

ObjDef * ObjDefManager::get ( ObjDefHandle handle) const
virtual

References getRaw(), OBJDEF_INVALID_INDEX, and validateHandle().

Referenced by get_objdef(), TestObjDef::testAddGetSetClear(), and TestObjDef::testClone().

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

◆ getByName()

ObjDef * ObjDefManager::getByName ( const std::string & name) const
virtual

References m_objects, and ObjDef::name.

Referenced by add(), get_objdef(), ModApiMapgen::l_get_biome_id(), ModApiMapgen::l_get_decoration_id(), and TestObjDef::testAddGetSetClear().

Here is the caller graph for this function:

◆ getNodeDef()

const NodeDefManager * ObjDefManager::getNodeDef ( ) const
inline

References m_ndef.

Referenced by get_or_load_biome(), get_or_load_schematic(), and ModApiMapgen::l_register_schematic().

Here is the caller graph for this function:

◆ getNumObjects()

size_t ObjDefManager::getNumObjects ( ) const
inline

References m_objects.

Referenced by BiomeManager::clear(), SchematicManager::clear(), TestObjDef::testAddGetSetClear(), and TestObjDef::testClone().

Here is the caller graph for this function:

◆ getObjectTitle()

virtual const char * ObjDefManager::getObjectTitle ( ) const
inlinevirtual

Reimplemented in BiomeManager, DecorationManager, OreManager, and SchematicManager.

Referenced by addRaw().

Here is the caller graph for this function:

◆ getRaw()

ObjDef * ObjDefManager::getRaw ( u32 index) const
virtual

References m_objects.

Referenced by BiomeManager::clear(), SchematicManager::clear(), get(), ModApiMapgen::l_get_biome_name(), and TestObjDef::testClone().

Here is the caller graph for this function:

◆ getType()

ObjDefType ObjDefManager::getType ( ) const
inline

References m_objtype.

Referenced by TestObjDef::testAddGetSetClear(), and TestObjDef::testClone().

Here is the caller graph for this function:

◆ set()

ObjDef * ObjDefManager::set ( ObjDefHandle handle,
ObjDef * obj )
virtual

References ObjDef::handle, ObjDef::index, OBJDEF_INVALID_INDEX, setRaw(), ObjDef::uid, and validateHandle().

Referenced by TestObjDef::testAddGetSetClear().

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

◆ setRaw()

ObjDef * ObjDefManager::setRaw ( u32 index,
ObjDef * obj )
virtual

References m_objects.

Referenced by set().

Here is the caller graph for this function:

◆ validateHandle()

u32 ObjDefManager::validateHandle ( ObjDefHandle handle) const

References decodeHandle(), m_objects, m_objtype, and OBJDEF_INVALID_HANDLE.

Referenced by get(), and set().

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

Member Data Documentation

◆ m_ndef

const NodeDefManager* ObjDefManager::m_ndef
protected

◆ m_objects

◆ m_objtype

ObjDefType ObjDefManager::m_objtype
protected

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