Luanti 5.16.0-dev
Loading...
Searching...
No Matches
MMVManip Class Reference

#include <map.h>

Inheritance diagram for MMVManip:
Collaboration diagram for MMVManip:

Public Member Functions

 MMVManip (Map *map)
virtual ~MMVManip ()=default
void initialEmerge (v3s16 blockpos_min, v3s16 blockpos_max, bool load_if_inexistent=true)
std::map< v3s16, bool > getCoveredBlocks () const
 Uses the flags array to determine which blocks the VManip covers, and for which of them we have any data.
void blitBackAll (std::map< v3s16, MapBlock * > *modified_blocks, bool overwrite_generated=true) const
 Writes data in VManip back to the map.
MMVManipclone () const
void reparent (Map *map)
bool isOrphan () const
Public Member Functions inherited from VoxelManipulator
 VoxelManipulator ()=default
virtual ~VoxelManipulator ()
MapNode getNode (const v3s16 &p)
MapNode getNodeNoEx (const v3s16 &p)
MapNode getNodeNoExNoEmerge (const v3s16 &p) const
MapNodegetNodeRefUnsafe (const v3s16 &p)
const MapNodegetNodeRefUnsafeCheckFlags (const v3s16 &p) const
u8 & getFlagsRefUnsafe (const v3s16 &p)
bool exists (const v3s16 &p)
void setNode (const v3s16 &p, const MapNode &n)
bool setNodeNoEmerge (const v3s16 &p, MapNode n)
void clear ()
void print (std::ostream &o, const NodeDefManager *nodemgr, VoxelPrintMode mode=VOXELPRINT_MATERIAL) const
void addArea (const VoxelArea &area)
void setFlags (const VoxelArea &area, u8 flag)
void clearFlags (const VoxelArea &area, u8 flag)
void copyFrom (MapNode *src, bool is_mono_block, const VoxelArea &src_area, v3s16 from_pos, v3s16 to_pos, const v3s16 &size)
void copyTo (MapNode *dst, const VoxelArea &dst_area, v3s16 dst_pos, v3s16 from_pos, const v3s16 &size) const

Public Attributes

bool m_is_dirty = false
Public Attributes inherited from VoxelManipulator
VoxelArea m_area
MapNodem_data = nullptr
u8 * m_flags = nullptr

Protected Member Functions

 MMVManip ()

Protected Attributes

Mapm_map = nullptr

Additional Inherited Members

Static Public Attributes inherited from VoxelManipulator
static const MapNode ContentIgnoreNode = MapNode(CONTENT_IGNORE)

Constructor & Destructor Documentation

◆ MMVManip() [1/2]

MMVManip::MMVManip ( Map * map)

References VoxelManipulator::VoxelManipulator(), and m_map.

Referenced by ~MMVManip(), and clone().

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

◆ ~MMVManip()

virtual MMVManip::~MMVManip ( )
virtualdefault

References MMVManip().

Here is the call graph for this function:

◆ MMVManip() [2/2]

MMVManip::MMVManip ( )
inlineprotected

Referenced by clone().

Here is the caller graph for this function:

Member Function Documentation

◆ blitBackAll()

void MMVManip::blitBackAll ( std::map< v3s16, MapBlock * > * modified_blocks,
bool overwrite_generated = true ) const

Writes data in VManip back to the map.

Blocks without any data in the VManip are skipped.

Note
VOXELFLAG_NO_DATA is checked per-block, not per-node. So you need to ensure that the relevant parts of m_data are initialized.
Parameters
modified_blocksoutput array of touched blocks (optional)
overwrite_generatedif false, blocks marked as generate in the map are not changed

References blockpos_over_max_limit(), MapBlock::copyFrom(), MapBlock::expireIsAirCache(), getCoveredBlocks(), MapBlock::isGenerated(), VoxelManipulator::m_area, m_map, MOD_REASON_VMANIP, MOD_STATE_WRITE_NEEDED, p(), MapBlock::raiseModified(), verbosestream, and warningstream.

Referenced by voxalgo::blit_back_with_light(), ServerMap::finishBlockMake(), LuaVoxelManip::l_write_to_map(), and TestVoxelManipulator::testBlitBack2().

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

◆ clone()

MMVManip * MMVManip::clone ( ) const

References MMVManip(), MMVManip(), VoxelManipulator::m_area, VoxelManipulator::m_data, VoxelManipulator::m_flags, and m_is_dirty.

Referenced by LuaVoxelManip::packIn(), and TestVoxelManipulator::testBlitBack().

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

◆ getCoveredBlocks()

std::map< v3s16, bool > MMVManip::getCoveredBlocks ( ) const

Uses the flags array to determine which blocks the VManip covers, and for which of them we have any data.

Warning
requires VManip area to be block-aligned
Returns
map of blockpos -> any data?

References getNodeBlockPos(), VoxelManipulator::m_area, VoxelManipulator::m_flags, MAP_BLOCKSIZE, VOXELFLAG_NO_DATA, x, y, and z.

Referenced by blitBackAll(), initialEmerge(), and TestVoxelManipulator::testBlitBack2().

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

◆ initialEmerge()

void MMVManip::initialEmerge ( v3s16 blockpos_min,
v3s16 blockpos_max,
bool load_if_inexistent = true )

References VoxelManipulator::addArea(), blockpos_over_max_limit(), MapBlock::copyTo(), emerge_time, getCoveredBlocks(), VoxelArea::getVolume(), infostream, VoxelManipulator::m_area, m_is_dirty, m_map, MAP_BLOCKSIZE, p(), VoxelArea::print(), VoxelManipulator::setFlags(), VOXELFLAG_NO_DATA, x, y, and z.

Referenced by Schematic::getSchematicFromMap(), ServerMap::initBlockMake(), Schematic::placeOnMap(), treegen::spawn_ltree(), TEST_CASE(), TestVoxelManipulator::testBlitBack(), TestVoxelManipulator::testEmerge(), and TestVoxelAlgorithms::testLighting().

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

◆ isOrphan()

bool MMVManip::isOrphan ( ) const
inline

References m_map.

Referenced by LuaVoxelManip::l_write_to_map(), and TestVoxelManipulator::testEmerge().

Here is the caller graph for this function:

◆ reparent()

void MMVManip::reparent ( Map * map)

References m_map.

Member Data Documentation

◆ m_is_dirty

bool MMVManip::m_is_dirty = false

◆ m_map

Map* MMVManip::m_map = nullptr
protected

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