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

#include <mapsector.h>

Collaboration diagram for MapSector:

Public Member Functions

 MapSector (Map *parent, v2s16 pos, IGameDef *gamedef)
virtual ~MapSector ()
void deleteBlocks (size_t *used_count=nullptr)
 Deletes all blocks (regardless of reference count).
v2s16 getPos () const
MapBlockgetBlockNoCreateNoEx (s16 y)
std::unique_ptr< MapBlockcreateBlankBlockNoInsert (s16 y)
MapBlockcreateBlankBlock (s16 y)
void insertBlock (std::unique_ptr< MapBlock > block)
void deleteBlock (MapBlock *block)
std::unique_ptr< MapBlockdetachBlock (MapBlock *block)
void getBlocks (MapBlockVect &dest)
const auto & getBlocks () const
const auto & getBlocks ()=delete
bool empty () const
size_t size () const

Protected Member Functions

MapBlockgetBlockBuffered (s16 y)

Protected Attributes

std::unordered_map< s16, std::unique_ptr< MapBlock > > m_blocks
Mapm_parent
v2s16 m_pos
IGameDefm_gamedef
MapBlockm_block_cache = nullptr
s16 m_block_cache_y

Constructor & Destructor Documentation

◆ MapSector()

MapSector::MapSector ( Map * parent,
v2s16 pos,
IGameDef * gamedef )

References m_gamedef, m_parent, and m_pos.

◆ ~MapSector()

MapSector::~MapSector ( )
virtual

References deleteBlocks().

Here is the call graph for this function:

Member Function Documentation

◆ createBlankBlock()

MapBlock * MapSector::createBlankBlock ( s16 y)

References createBlankBlockNoInsert(), m_blocks, and y.

Referenced by ServerMap::createBlock(), ServerMap::emergeBlock(), and Client::handleCommand_BlockData().

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

◆ createBlankBlockNoInsert()

std::unique_ptr< MapBlock > MapSector::createBlankBlockNoInsert ( s16 y)

References blockpos_over_max_limit(), getBlockBuffered(), m_gamedef, m_pos, and y.

Referenced by createBlankBlock(), and ServerMap::loadBlock().

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

◆ deleteBlock()

void MapSector::deleteBlock ( MapBlock * block)

References detachBlock().

Referenced by Map::timerUpdate().

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

◆ deleteBlocks()

void MapSector::deleteBlocks ( size_t * used_count = nullptr)

Deletes all blocks (regardless of reference count).

Parameters
used_countoutput: number of blocks which were still ref'd

References m_block_cache, and m_blocks.

Referenced by ~MapSector().

Here is the caller graph for this function:

◆ detachBlock()

std::unique_ptr< MapBlock > MapSector::detachBlock ( MapBlock * block)

References MapBlock::getPos(), m_block_cache, m_blocks, and MapBlock::makeOrphan().

Referenced by deleteBlock(), and ServerMap::deleteBlock().

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

◆ empty()

bool MapSector::empty ( ) const
inline

References m_blocks.

◆ getBlockBuffered()

MapBlock * MapSector::getBlockBuffered ( s16 y)
protected

References m_block_cache, m_block_cache_y, m_blocks, and y.

Referenced by createBlankBlockNoInsert(), getBlockNoCreateNoEx(), and insertBlock().

Here is the caller graph for this function:

◆ getBlockNoCreateNoEx()

MapBlock * MapSector::getBlockNoCreateNoEx ( s16 y)

References getBlockBuffered(), and y.

Referenced by ServerMap::createBlock(), Map::getBlockNoCreateNoEx(), Client::handleCommand_BlockData(), and ServerMap::loadBlock().

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

◆ getBlocks() [1/3]

const auto & MapSector::getBlocks ( ) const
inline

References m_blocks.

◆ getBlocks() [2/3]

const auto & MapSector::getBlocks ( )
delete

◆ getBlocks() [3/3]

void MapSector::getBlocks ( MapBlockVect & dest)

References m_blocks.

Referenced by ServerMap::listAllLoadedBlocks(), ServerMap::save(), Map::timerUpdate(), ClientMap::touchMapBlocks(), ClientMap::updateDrawList(), and ClientMap::updateDrawListShadow().

Here is the caller graph for this function:

◆ getPos()

v2s16 MapSector::getPos ( ) const
inline

References m_pos.

Referenced by Client::handleCommand_BlockData(), ClientMap::touchMapBlocks(), and ClientMap::updateDrawList().

Here is the caller graph for this function:

◆ insertBlock()

void MapSector::insertBlock ( std::unique_ptr< MapBlock > block)

References getBlockBuffered(), m_blocks, and m_pos.

Referenced by ServerMap::loadBlock().

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

◆ size()

size_t MapSector::size ( ) const
inline

References m_blocks.

Referenced by ClientMap::touchMapBlocks(), ClientMap::updateDrawList(), and ClientMap::updateDrawListShadow().

Here is the caller graph for this function:

Member Data Documentation

◆ m_block_cache

MapBlock* MapSector::m_block_cache = nullptr
protected

◆ m_block_cache_y

s16 MapSector::m_block_cache_y
protected

Referenced by getBlockBuffered().

◆ m_blocks

std::unordered_map<s16, std::unique_ptr<MapBlock> > MapSector::m_blocks
protected

◆ m_gamedef

IGameDef* MapSector::m_gamedef
protected

◆ m_parent

Map* MapSector::m_parent
protected

Referenced by MapSector().

◆ m_pos

v2s16 MapSector::m_pos
protected

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